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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Loop over plots in a graph layer
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

AKazak

Russia
1205 Posts

Posted - 06/10/2022 :  02:23:46 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 2022b (64-bit) SR1 9.9.5.167
Windows 7 Pro SP1 x64

Greetings!

A graph window has page. A page has layers. Layers have plots and graphic objects.
I know a way to loop over graphic objects (https://www.originlab.com/doc/LabTalk/guide/Looping-Over-objs#Looping_Over_Graphic_Objects).
However I couldn't find a way to loop over plots.

https://www.originlab.com/doc/LabTalk/ref/Layer-obj suggests to use
layer.plot

to get or set the active plot number (index).

How do I get the total number of plots in a layer?
How do I loop over the layer plots and modify their formatting?

Thank you.

---
Andrey

minimax

348 Posts

Posted - 06/10/2022 :  02:47:32 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Basically all looping is in document command.

https://www.originlab.com/doc/labtalk/ref/document-cmd#-e_object_.7Bscript.7D.3B_Execute_the_given_script_for_all_objects

Use set command to modify plot's property.
https://www.originlab.com/doc/Labtalk/Ref/Set-cmd


// set all scatter plots symbol size as 20
document -e dy {
	set %c -z 20;
};
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 06/10/2022 :  03:12:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by minimax

Basically all looping is in document command.

https://www.originlab.com/doc/labtalk/ref/document-cmd#-e_object_.7Bscript.7D.3B_Execute_the_given_script_for_all_objects

Use set command to modify plot's property.
https://www.originlab.com/doc/Labtalk/Ref/Set-cmd


// set all scatter plots symbol size as 20
document -e dy {
	set %c -z 20;
};




Got it.

How do I get the total number of plots in a layer into a variable?

---
Andrey
Go to Top of Page

minimax

348 Posts

Posted - 06/10/2022 :  03:22:22 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
https://www.originlab.com/doc/en/LabTalk/ref/Layer-cmd#-c.3B_count_datasets_plotted_in_the_active_layer

layer -c;
count=;
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 06/10/2022 :  03:52:13 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by minimax

https://www.originlab.com/doc/en/LabTalk/ref/Layer-cmd#-c.3B_count_datasets_plotted_in_the_active_layer

layer -c;
count=;




Got it.
I could not find this help page easily.

Related question
Can you also comment on the meaning of the dataset while working with graph. I want to understand the difference between plot and dataset (associated with the plot).
For example, while looping through graphs %C contains the name of the active dataset (not active plot). How do I link plot and dataset toghether?

---
Andrey
Go to Top of Page

minimax

348 Posts

Posted - 06/10/2022 :  04:16:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
maybe the document is too rough to be precise.

A rough(again...) description is:

loop over graph, it works on plot;
loop over worksheet, it works on dataset (column);
loop over matrix sheet, it works on matrix object.
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 06/10/2022 :  05:23:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by minimax

maybe the document is too rough to be precise.

A rough(again...) description is:

loop over graph, it works on plot;
loop over worksheet, it works on dataset (column);
loop over matrix sheet, it works on matrix object.



Thank you.
I agree that the help pages have to be corrected.
Ideally, I want to see an Origin object hierarchy schematics to navigate easily.

---
Andrey
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000