Author |
Topic  |
|
JThieser
16 Posts |
Posted - 01/09/2012 : 05:46:11 AM
|
Hi, i have a short question. I have a worksheet with backtrajectories data. So several pairs of x and y data. Now i would like to color map each of these pairs by a number so that in the end i can use a color scale to show the numbers of the different trajectories. And i thought to add to each pair a colunm in which i write the number. Then i though to plot them and use the color coding option to map each pair of x and Y with this new inserted colunm. So is there a option to do that with a lab talk script???
Thanks alot
Jim
Origin Ver. and Service Release (Select Help-->About Origin): Operating System: |
|
Penn
China
644 Posts |
Posted - 01/10/2012 : 02:37:31 AM
|
Hi Jim,
Maybe the following script can meet your requirement. You can have a try.
worksheet -s 1 0 3 0; // select the first three column, x, y, and color map
worksheet -p 193 scatter; // plot a scatter plot with color map
Penn |
 |
|
JThieser
16 Posts |
Posted - 01/10/2012 : 02:55:53 AM
|
Hey thanks a lot for your answer. But unlikely it is not that what I'm looking for. But thanks! Jim |
 |
|
Drbobshepherd
USA
Posts |
Posted - 01/10/2012 : 11:46:28 AM
|
You may have discovered a bug. I have no problem plotting a colormap scatter plot in Origin, but I too cannot seem to do it with a LabTalk script. There seems to be a plot type for a colormap scatter plot (plot type 247) but when I execute it in a script, using the plotxy X-function, I cannot get it to work. I get a scatter plot, or an error plot, or a colormap plot that doesn't know where the color-index column is. And the help files do not give an example of "plotxy type:=247". I even tried using a template of the Origin-generated colormap plot, but it didn't work either.
I am sorry, but I think LabTalk may not be able to plot colormapped scatter plots without you having to manually manipulate them after they are generated. Or, you may have to use OriginC.
If someone can get a Labtalk script to generate your plots, I'd really like to know how. |
 |
|
Drbobshepherd
USA
Posts |
Posted - 01/10/2012 : 2:39:55 PM
|
Eureka! Here is how you can script a colormapped scatter plot:
1. Plot one of your (x,y,icolor) worksheets the way you want. One way is to use the Origin/Plot/Symbol/ColorMapped pull-down menu, then left-click on the graph to set up Plot Details, such as symbols, levels, colors, etc. 2. Save graph as a template with a unique name, such as MyColorMap. 3. Use "worksheet -s" to select the 3 columns for your next plot (See Help file for correct usage). 3. Use "worksheet -p 247 MyColorMap" to draw your graph.
Note: icolor values need to be integers greater than 0. |
 |
|
Penn
China
644 Posts |
Posted - 01/10/2012 : 9:52:49 PM
|
Hi,
Sorry that I make a mistake. Drbobshepherd is right, the plot type should be 247, but not 193. However, no need to create a template, just use the built-in template, scatter.
worksheet -s 1 0 3 0; // select the first three column, x, y, and color map
worksheet -p 247 scatter; // plot a scatter plot with color map
And the color index can be also used. For example:
plotxy iy:=(1,2) plot:=201; // plot scatter plot
set %C -c 102; // use the first column to the right of Y as color index
By the way, the plotxy X-Function is mainly used for creating data plot from XY range or XYError range. So, there would be problem for creating colormap plot.
Penn |
 |
|
JThieser
16 Posts |
Posted - 01/11/2012 : 03:59:36 AM
|
Hey Guys, thank you very much fo all your suggestions. But I think for my problem it doesn't will work out and i think i have to do it by hand. Because I wanted to have e.g. 10 lines in one graph and this 10 graphs should be colormapped by for each line with one colunm. So it is no problem doing it by hand but in the end I have in total about 100 of these trajectories so I though it will be much faster with a script but ok.. Thanks a lot
Jim |
 |
|
|
Topic  |
|
|
|