The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Colouring Dot Plots

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
wallacej Posted - 01/28/2005 : 08:53:12 AM
Origin Version (7.5):
Operating System:Windows 2000

I have a LabTalk script that creates a 3D surface plot from my data. (length, shape, frequency) (X, Y, Z).

I also have a LabTalk script that creates a 2D scatter plot from the same data. (length, shape) (X, Y).

I would like to colour each of the dots in the 2D graph according to a scale based on the Z values from my data.

A result very similar to the contour plot is desirable, but it is important to still have the actual dots displayed.

Thank You
4   L A T E S T    R E P L I E S    (Newest First)
easwar Posted - 02/01/2005 : 3:40:30 PM
Hi,

The values you want to use or indexing does not have to be in the column right next to the Y column, but needs to be in the same worksheet in a later column. So say the worksheet is set up such that X, Y are in cols 1, 2 and Z/color index is in col 10.
So the color column is the 8th col to the right of the Y column.
In this case, you will then need to change the code to:
dp.Curve.Symbol.EdgeColor.nVal = 4194404 + 8;

Easwar
OriginLab




Edited by - easwar on 02/01/2005 3:43:54 PM
wallacej Posted - 02/01/2005 : 12:37:01 PM
I'm having some problems with the above code. My data isn't exactly in three adjacent columns x,y,z. I used this terminology for descriptive purposes.

The data is in a large worksheet. x is in column 1, y is column 4 and Z is generated by a calculation, ie to get the frequency. Because of this reason I am having trouble using the colour mapping as supplied, presumably because it uses the value that:

"use color mapping and get the mapping values from the column right next to the Y column".

Anymore ideas?

Thank You for your time
wallacej Posted - 01/31/2005 : 05:19:07 AM
Thank You for that help, I'll let you know how I get on.

Thanks
easwar Posted - 01/28/2005 : 4:50:30 PM
Hi,

Here is an Origin C solution that creates the scatter plot from cols 1,2 of the wks and uses col 3 to set the color map of the scatter points. Once such a function is compiled and ready, you can call it from your LabTalk script or from the Script Window.


void plot_symbol_color_map()
{
// Assumes worksheet with three columns set to
// X, Y, Z where z column contains data to be used
// for color map
//
// Declare worksheet from active layer
Worksheet wks = Project.ActiveLayer();
// Create a new graph page
GraphPage gpg;
gpg.Create();
// Point to layer 1
GraphLayer gly = gpg.Layers(0);
// Make a curve object from cols 1, 2 of wks
Curve crv(wks, 0, 1);
// Plot curve as scatter plot
gly.AddPlot(crv, IDM_PLOT_SCATTER);
// Point to the data plot object for the plot
DataPlot dp = gly.DataPlots(0);
// Change the edge color setting to color map based on col 3
dp.Curve.Symbol.EdgeColor.nVal = 4194405;
// Rescale the layer
gly.Rescale();
}



In the above code, the Edge Color property is set to the value 4194405 which means "use color mapping and get the mapping values from the column right next to the Y column". Currently there are no constants defined for such values. You can determine what value to use by first making an instance of the graph manually in the GUI, and then running code such as below which gets the plot properties to a tree and then dumps the properties to the script window.


void dump_plot_properties()
{
GraphLayer gly = Project.ActiveLayer();
DataPlot dp = gly.DataPlots(0);
Tree tr;
tr = dp.Curve.Symbol;
out_tree(tr);
}



Easwar
OriginLab



The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000