Author |
Topic  |
|
ringman7677
USA
16 Posts |
Posted - 03/09/2004 : 12:21:47 PM
|
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
|
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 |
 |
|
ringman7677
USA
16 Posts |
Posted - 03/09/2004 : 2:41:35 PM
|
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 |
 |
|
Mike
USA
357 Posts |
Posted - 03/09/2004 : 2:58:08 PM
|
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 |
 |
|
Mike Buess
USA
3037 Posts |
Posted - 03/09/2004 : 3:05:38 PM
|
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 |
 |
|
Mike Buess
USA
3037 Posts |
Posted - 03/09/2004 : 3:36:18 PM
|
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 |
 |
|
rdremov
USA
28 Posts |
Posted - 03/09/2004 : 6:02:23 PM
|
In Origin 7.5 there is a simple GUI option "Include All Data Plots in Legend" available in PlotDetails dialog, Legend tab.
Thanks, Roman. |
 |
|
ringman7677
USA
16 Posts |
Posted - 03/12/2004 : 5:04:22 PM
|
Looks like I need Origin 7.5 |
 |
|
|
Topic  |
|