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
 Forum for Python
 Set up the legend

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
cts18488 Posted - 11/29/2021 : 11:36:32 AM
Hi,

I have a series of spectra and for each spectrum Origin is generating a line in legend. Is there a way in Python to show the legend for only a spectrum and remove the line before the name? I want to use the legend as a title, as there is not a lot of space to set up the title for each graph (please see the first line of graphs in the picture for more information)

Thank you,
Tibi


Origin Ver. 2021b and Service Release: SR2
Operating System: Win 10 Ent
2   L A T E S T    R E P L I E S    (Newest First)
cts18488 Posted - 12/07/2021 : 07:24:05 AM
Thank you a lot!

quote:
Originally posted by YimingChen

You need to obtain the legend object for each layer and change its text. Try the code below:

for gl in gp:
    lgnd = gl.label('Legend')
    lgnd.text=' \l(1) %(1)'


Must have something different from internal "\l(1) %(1)" to prevent auto expending so I just added a space, but you can add a caption or whatever as long as it is different from the generic internal form

We added this as another sample on github

https://github.com/originlab/Python-Samples/blob/main/4.%20Graphing/Graph%20Legend%20to%20Show%20Only%20First%20Plot.py

James

YimingChen Posted - 11/29/2021 : 5:05:17 PM
You need to obtain the legend object for each layer and change its text. Try the code below:

for gl in gp:
    lgnd = gl.label('Legend')
    lgnd.text=' \l(1) %(1)'


Must have something different from internal "\l(1) %(1)" to prevent auto expending so I just added a space, but you can add a caption or whatever as long as it is different from the generic internal form

We added this as another sample on github

https://github.com/originlab/Python-Samples/blob/main/4.%20Graphing/Graph%20Legend%20to%20Show%20Only%20First%20Plot.py

James

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