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 for Programming
 Forum for Python
 Adding a textbox to a plot
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

jan.oechsler

Germany
8 Posts

Posted - 02/08/2021 :  12:42:00 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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.

Chris D

428 Posts

Posted - 02/08/2021 :  4:24:54 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

jan.oechsler

Germany
8 Posts

Posted - 02/11/2021 :  08:01:13 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
thanks, that helped a lot!
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