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
 Alter Plot's 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
i.reuter Posted - 08/10/2021 : 05:34:56 AM
I need to plot several regions of the same column. The following code works fine to create the demanded plot:


graph = op.new_graph(template='scatter')
gl=graph[0]
for index, halfcycle in halfcycles.iterrows():
    if index%10 == 0:
        plot = gl.add_plot(f'[Book1]Sheet1!("current_interpolated","potential_interpolated")[{halfcycle["start"]}:{halfcycle["end"]}]', type='s')
gl.group(True,0,-1)
gl.rescale()


Unfortunately, this creates a legend with the same entry (column name) for each plot. I cannot find a way to create a legend like this:
- Potential (halfcycle 0)
* Potential (halfcycle 10)
# Potential (halfcycle 20)
x ...
Where the number represents the value of the index variable in the for-loop above.

Any help is very much appreciated.


Origin Ver. and Service Release: 2021b / 9.8.5.201
Operating System: Windows 10 / 1809ESR
1   L A T E S T    R E P L I E S    (Newest First)
YimingChen Posted - 08/10/2021 : 09:23:57 AM
You may create a string and pass it to lgnd.text. See the Python example:
https://www.originlab.com/doc/python/Examples/Graphing#Multiple_Layer_Plot

For the legend entry syntax, you may refer to:
https://www.originlab.com/doc/LabTalk/ref/Legend-Substitution-Notation

James

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