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 Reference Line with Label Programmatically

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
jodokusquack Posted - 07/14/2023 : 05:37:36 AM
Origin Ver. and Service Release (Select Help-->About Origin):OriginPro 2022 (64-bit) SR1
Operating System: Windows 11

Hi, I am using external python and the originpro package to automatically import my data and create plots from this data.

I am now trying to add Reference Lines with a label at specific x-positions just like it is possible from the Axis dialog box under the 'Reference Lines' tab.

So far, I have only found the X-function 'addline' which I was able to call from Python but this did not allow me to have arbitrary labels for the line.

Is there a possibility to automatically add Reference lines at some given x-values with String-labels also provided from the Python program?

Thanks in advance for any help.
4   L A T E S T    R E P L I E S    (Newest First)
jodokusquack Posted - 07/20/2023 : 03:27:37 AM
Thank you very much for the help!
This works too.
YimingChen Posted - 07/19/2023 : 2:43:06 PM
Try the script below

import originpro as op
gl = op.new_graph()[0]
gl.set_int('x.reflines.count',1)
gl.set_int('x.reflines.lineshow',1)
gl.set_float('x.refline1.value',4)
gl.set_int('x.refline1.labelshow',1)
gl.set_str('x.refline1.labeltext','abc')
gl.lt_exec("RLX1.rotate=90") ## RLX1 is the object name of the label


quote:
Originally posted by jodokusquack

Nice, it works! Thank you very much for the script.

Would it also be possible to rotate the label so that they are displayed vertically?

In some of my plots the labels overlap if I add too many and having them vertically would be more space-saving.

jodokusquack Posted - 07/19/2023 : 11:33:55 AM
Nice, it works! Thank you very much for the script.

Would it also be possible to rotate the label so that they are displayed vertically?

In some of my plots the labels overlap if I add too many and having them vertically would be more space-saving.
YimingChen Posted - 07/18/2023 : 3:56:21 PM
Could you try the Python script below?

import originpro as op
gl = op.new_graph()[0]
gl.set_int('x.reflines.count',1)
gl.set_int('x.reflines.lineshow',1)
gl.set_float('x.refline1.value',4)
gl.set_int('x.refline1.labelshow',1)
gl.set_str('x.refline1.labeltext','abc')


James

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