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
 setting symbol shape in for loop

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
JokerOne 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
}
4   L A T E S T    R E P L I E S    (Newest First)
cpyang 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
} 

Hideo Fujii 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
JokerOne 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.

cpyang 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
} 


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