Author |
Topic  |
|
JokerOne
Germany
58 Posts |
Posted - 02/25/2016 : 05:48:27 AM
|
Origin Ver. 9.1 and Service Release 1(Select Help-->About Origin): Operating System: Win7
Hello everybody,
once again I am that LabTalk-desperate, that I request your help:
In the following code, I cannot manage to set the symbol shape to "circle" for all of the data plots generated in the loop, only at the first plot, the changes are visible.
In my struggling I tried both of the for loops below. Both show the same result.
Any help is appreciated.
First try:
for (ii=1;ii<= 3; ii++) { x_point_plot = {1}; y_point_plot = {1}; plotxy iy:=(x_point_plot,y_point_plot) plot:=201 ogl:=[MyGraph]1! color:=(ii+1); layer -c; // the resulting number is set in the internal variable "count" type $(count); range rr = [MyGraph]Layer1!$(count); // Create the according range set rr -k 2; // Set marker type }
Second try:
for (ii=1;ii<= 3; ii++) { x_point_plot = {1}; y_point_plot = {1}; plotxy iy:=(x_point_plot,y_point_plot) plot:=201 ogl:=[MyGraph2]1! color:=(ii+1); set %C -k 2; // Set marker type } |
|
cpyang
USA
1406 Posts |
Posted - 02/25/2016 : 08:51:27 AM
|
Can you use real data? To make a graph, data must be somewhere outside the graph, as the graph simply plot the actual data. I tried this and it worked fine
int npts = 3;
range ss = [book1]1!;
ss.ncols=2 * npts; // XY
for (int ii=1, jj=1;ii<= 3; ii++,jj++)
{
range xx = [book1]1!$(jj);jj++;
range yy = [book1]1!$(jj);
xx = {1,2};
yy = {$(ii),$(jj)};
plotxy iy:=(xx,yy) plot:=201 ogl:=[MyGraph]1! color:=(ii+1);
layer -c; // the resulting number is set in the internal variable "count"
type $(count);
range rr = [MyGraph]Layer1!$(count); // Create the according range
set rr -k 2; // Set marker type
}
|
 |
|
JokerOne
Germany
58 Posts |
Posted - 02/25/2016 : 09:06:16 AM
|
Thanks for the answer.
Sorry, I might have stated this not too clear: The plot itself works, the data are plot, but the symbol shape is not changed to "circle" (option - k 2).
This still holds true for the code you proposed, unfortunately.
 |
 |
|
Hideo Fujii
USA
1582 Posts |
Posted - 02/25/2016 : 2:56:26 PM
|
Hi JokerOne、
Your sample code has plotted the same dataset repeatedly as shown below:

So, no matter referred by %C or the dataset name, it always points the first plot. (The same dataset name cannot make the plots distinguishable each other.) To solve the problem, you have to create separate datasets like:for (ii=1;ii<= 3; ii++) {
x_point_plot$(ii) = {1,2,3};
y_point_plot$(ii) = {10,20,30};
plotxy iy:=(x_point_plot$(ii),y_point_plot$(ii)) plot:=201 ogl:=[MyGraph2]1! color:=(ii+1);
set y_point_plot$(ii) -k 2; // Set marker type
} As cpyang has suggested, if you used the real data, you wouldn't have encountered such confusing situation.
Hope this makes sense.
--Hideo Fujii OriginLab |
Edited by - Hideo Fujii on 02/25/2016 3:01:29 PM |
 |
|
cpyang
USA
1406 Posts |
Posted - 02/25/2016 : 9:51:11 PM
|
I don't have Origin9.1, I checked in 2015 and my original code worked fine with symbols set to circle.
If you don't want to use book, just want graph with loose data, you will still need to have different data for each plot, try the following:
//run with clean new session of Origin
[Main]
win -t plot origin mygraph;
for (ii=1;ii<= 3; ii++)
{
x_point_plot$(ii) = {1,2};
y_point_plot$(ii) = {$(ii),$(ii)+1};
plotxy iy:=(x_point_plot$(ii),y_point_plot$(ii)) plot:=201 ogl:=[MyGraph]1! color:=(ii+1);
layer -c; // the resulting number is set in the internal variable "count"
type $(count);
range rr = [MyGraph]Layer1!$(count); // Create the according range
set rr -k 2; // Set marker type
}
|
 |
|
|
Topic  |
|
|
|