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
 Origin Forum
 Graph doesn't change after data change with script
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

jacorem

Italy
8 Posts

Posted - 07/18/2024 :  03:47:40 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version: OriginPro 2023
Service Release: 10.0.0.154
Operating System: Windows 11

Hello everybody,
a couple of days ago, some collaborators, asked my help to evaluate the samples they prepared using different methods (they varied 4/5 preparation parameters) using X-Ray Diffraction. I observed 7 peaks that I have analysed externally, and for each peak I would like to analyse 7 figures of merits (i.e. position, width, area, ...). In short, it means LOTS of datasets. And in theory I would like to make similar plots where each time I'm comparing the results vs. one of the preparation parameters.

My idea was then to prepare a folder with all the plots where the X data was one of the preparation parameters, copy the folder, change the X data using the following script (thanks for the version goes to YimingChen in https://my.originlab.com/forum/topic.asp?TOPIC_ID=48241):

range XDataCol=[fitData]1!93; // my new X data
doc -ef P { // loop over graph windows in the current folder
	doc -ef LW { // loop over the layers in the current window
		layerNo=Page.active;
		doc -ef DY { // loop over the datasets in the current layer
			int nplot = layer.plot;
			layer -cx XDataCol $(nplot); // set the range "XDataCol" to be used as X data in plot # nplot
		}
	}
	doc -uw; // tried this and other version of the command to force an update
}


This code more or less work because it changes the X data associated with all the datasets to the correct column in the "Plot setup" window (and if I click on "Preview" there, I can see the correct graph), however the graph itself remain unchanged (old x data are still used).

What am I doing wrong? How can I fix my script/force a graph update?

Thanks in advance,

Jacopo

aplotnikov

Germany
160 Posts

Posted - 07/18/2024 :  09:31:02 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
lay -a;
Go to Top of Page

jacorem

Italy
8 Posts

Posted - 07/19/2024 :  03:23:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by aplotnikov

lay -a;



Dear aplotnikov,
I tried to run the command you suggested after my script, but it does not work.
Looking around (https://www.originlab.com/doc/LabTalk/ref/Layer-cmd#Options_for_Graph) it seems that your command rescale the X and Y axis so to show everything, however, my problem, is that the x data associated to each data point does not change (if it may help, the X title changes so to match the long name of the new column, but the position of each point remain unchanged).
Thanks anyway,
Jacopo
Go to Top of Page

aplotnikov

Germany
160 Posts

Posted - 07/25/2024 :  03:29:02 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by jacorem
I tried to run the command you suggested after my script, but it does not work.

I checked that out prior to replying, however I used the v.2024b - I guess, the version number does not matter in this particular case. It worked perfectly. You need to run it within the loop over the layers:
doc -ef LW {
     ...
     lay -a;
}
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