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
 Plotting into layers using templates

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
cdrozdowski111 Posted - 12/28/2012 : 10:41:57 AM
OriginPro 9.0.0 SR1, Win7 64-bit, running in VMware Fusion 5.0.2


How do I add a plot to a linked layer such that the added plot uses a graph template?

E.g.:


// Create graph
win -t p "MyTemplate1";

// Add three layers
for (int ii = 1; ii <=3; ii++)
{
layadd type:=0 userdef:=1 bottom:=0 left:=0 top:=0 right:=0 link:=1 xaxis:=straight yaxis:=0 activate:=1;

layer.fixed = 1; // Add properties of layer


// Now, add a plot to the newly created layer using a graph template named "MyTemplate2"
}
1   L A T E S T    R E P L I E S    (Newest First)
greg Posted - 12/31/2012 : 09:38:27 AM
Templates contain Layers which can include Style Holders for Dataplots and you can add Templates(Layers) to an existing graph, then add data into those Layers which will use the existing Style Holders, but you cannot add data to a Layer by using a Template as you suggest.

I see you have used the layadd X-Function. It would be nice if it had an argument to specify Template name, but the following will use another method to add layers which can specify a template, but which requires some help with linking...

Suppose I have four Templates each consisting of one layer and I have a worksheet with one column I will use as X and five as Y. I could construct a four layer graph by loading one template and adding three more, then adding X,Y data ranges to each layer which will use the Style Holders in the Template.

// Create a Graph window using one of my Templates
win -t plot MyLayer1;
// Define the X,Y ranges I will be plotting
range rad1 = [Book1]Sheet1!(1,2);
range rad2 = [Book1]Sheet1!(1,3);
range rad3 = [Book1]Sheet1!(1,4);
range rad4 = [Book1]Sheet1!(1,5);
range rad5 = [Book1]Sheet1!(1,6);
// Define a macro to handle linking, axis hiding
def LinkAndHide {
layer.link = 1; // This forces 1:1 links for X and Y
layer.y.link=0; // Shut off the Y link
layer.x.showaxes=0;
layer.x.showlabels=0;
layer.y.showaxes=0;
layer.y.showlabels=0;
}
// Add my other Templates
page -l MyLayer2;
LinkAndHide;
page -l MyLayer3;
LinkAndHide;
page -l MyLayer4;
LinkAndHide;
// Activate Layers and add data
page.active = 1;
layer -i rad1;
page.active = 2;
layer -i rad2;
page.active = 3;
layer -i rad3;
page.active = 4;
layer -i rad4;
layer -i rad5;

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