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
 Adding a textbox to a plot

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
jan.oechsler Posted - 02/08/2021 : 12:42:00 PM
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 2021 (64-bit) 9.8.0.200 (Lehre)
Operating System: Win 10 Edu

Is it possible to add a textbox to a plot using python? I extract some metadata from a datafile and would like to add this information to the origin plot as a text box (as in a legend). I didnt find anything useful in the documentation though.
2   L A T E S T    R E P L I E S    (Newest First)
jan.oechsler Posted - 02/11/2021 : 08:01:13 AM
thanks, that helped a lot!
Chris D Posted - 02/08/2021 : 4:24:54 PM
If using the `originpro` package, try:

import originpro as op

text = 'This is a label'
gr = op.find_graph('Graph1')
lay = gr[0]
lay.obj.LT_execute(f'label -a 10 10 "{text}"')


BUT, you really are better off using graph templates. We have a nice blog about how to do it:
http://blog.originlab.com/origin-graph-templates-for-python-developers

Put your label on the template because you can style and position it really nicely.

Later in your Python code, you can set it's text like


gr = op.find_graph() # Active graph
lay = gr[0] # First layer
label = lay.label('my_label')
label.text = 'Some sort of text'


Thanks,
Chris Drozdowski
Originlab Technical Support

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