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
 Script to change graph references

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
LC_ Posted - 05/24/2011 : 04:28:49 AM
Origin Ver. and Service Release (Select Help-->About Origin): 8.5.0 SR1
Operating System: Win 7

Hi

Assume I have several similarly formatted workbooks with same column structures. I have a (usually complex line+symbol graphs) graph for which I would like to be plotted for other workbooks as well. As I couldn't find a simple way of duplicating the plot structure across different workbooks in a similar fashion of Analysis Templates (is there any way of doing it?) I'm inclined to doing it via script.

So the idea was to write a script that duplicates a graph, and swaps the workbook reference for every plot in the graph. I didn't find a command for doing changing the plot reference in the command list, and if I tried to loop trough the graphs re-plotting every line the formatting would probably be lost, differently from what would happen if you replaced manually each plot using Plot Setup.

Some directions are much appreciated.
3   L A T E S T    R E P L I E S    (Newest First)
LC_ Posted - 05/26/2011 : 03:13:35 AM
Thanks guys. I will try it next week and let you know!
Penn Posted - 05/26/2011 : 02:29:28 AM
Hi,

First of all, you can save the first graph you make as a template (you can do it by menu File: Save Template As when the graph is active). And then use the document command to loop over all the workbooks in the project for creating graphs.

In each loop cycle, firstly, use the win command to open the saved template, and then the plotxy X-Function can be used to add plots to the template. Because I don't know what is your data and how your graph looks like, here I just show a simple example on how to use the commands mentioned above.

// execute the script for all workbook in the project
document -e W
{
	range rx = [%H]1!1;  // x column
	range ry = [%H]1!2:5;  // multiple y columns
	win -t p myTem.otp;  // open the template, named myTem.otp
	plotxy iy:=(rx, ry) plot:=202 ogl:=1;  // plot line+symbol to layer 1	
}


Penn
Sam Fang Posted - 05/26/2011 : 02:28:27 AM
Origin's theme can apply a graph's format on other graphs.

If you want to use Labtalk script, you can save your graph as a template. Then use script to plot data in other workbooks using the template. Labtalk also provides command to add a plot into an existing layer. See the page for details.
http://wiki.originlab.com/~originla/ltwiki/index.php?title=Script:Creating_Graphs

We already have reported a JIRA ORG-8 about your suggestion to change data for a plot. It may be available in the future.

Thanks.

Sam
OriginLab Technical Services

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