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
 combining layer legends
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ringman7677

USA
16 Posts

Posted - 03/09/2004 :  12:21:47 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Is there an easy way to create one legend that contains all of the layers of a plot?

Mike Buess

USA
3037 Posts

Posted - 03/09/2004 :  12:55:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
loop (ii,1,page.nlayers) {
if(ii==1) %L=Layer 1;
else %L=%L
Layer $(ii);
lay -o ii {
%Z=""; lay -c;
loop (jj,1,count) {
%L=%L
\l($(jj)) %[%Z,#jj];
};
};
};
label -s -n legend %L;

That will put the full dataset names in the legend. If you just want the names you usually see in the legend replace %[%Z,#jj] with %(jj).

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 03/09/2004 1:07:42 PM
Go to Top of Page

ringman7677

USA
16 Posts

Posted - 03/09/2004 :  2:41:35 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for the script. It has one glitch. The final legend uses the linetype/color for all the lines in the legend based on the layer selected before running the script. Also, can a return be put in so they are stacked in the legend?

Edited by - ringman7677 on 03/09/2004 2:44:37 PM
Go to Top of Page

Mike

USA
357 Posts

Posted - 03/09/2004 :  2:58:08 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Note that you can do this through the user interface, too (assuming that you are using Origin 7.5).

For information, see the Origin Help file (Help: Origin) and search for the topic "Displaying Data Plots from Different Layers in One Legend."

Mike Genthner
Documentation Specialist
OriginLab
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 03/09/2004 :  3:05:38 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
The final legend uses the linetype/color for all the lines in the legend based on the layer selected before running the script
I can't reproduce that. All lines/symbols/colors fit the individual plot types/colors.

...Now I see what you're saying and see no way around it. \l(n) can only refer to one layer at a time.

quote:
Also, can a return be put in so they are stacked in the legend?


They should be stacked as the script is written now. For example,

%L=%L
Layer $(ii); // adds a return before appending Layer $(ii) to %L.

%L=%L Layer $(ii); // puts everything in the same line.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 03/09/2004 3:15:25 PM
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 03/09/2004 :  3:36:18 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This will work in Origin 7.0 and 7.5. (Don't know about earlier versions.)

loop (ii,1,page.nlayers) {
if(ii==1) %L=Layer 1;
else %L=%L
Layer $(ii);
lay -o ii {
%Z=""; lay -c;
loop (jj,1,count) {
%L=%L
\l($(ii).$(jj)) %($(ii).$(jj));
};
};
};
label -s -n legend %L;

Mike Buess
Origin WebRing Member
Go to Top of Page

rdremov

USA
28 Posts

Posted - 03/09/2004 :  6:02:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
In Origin 7.5 there is a simple GUI option "Include All Data Plots in Legend" available in PlotDetails dialog, Legend tab.

Thanks,
Roman.
Go to Top of Page

ringman7677

USA
16 Posts

Posted - 03/12/2004 :  5:04:22 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Looks like I need Origin 7.5
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