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
 How to change right Y axis title

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
sangjung Posted - 06/17/2025 : 01:00:16 AM
Origin Ver. and Service Release (Select Help-->About Origin):2024b
Operating System: Win10

Hello,

I'm creating an automation tool in Python to generate graphs in OriginLab. I've successfully added a right Y-axis and specified its range. However, I'm unsure how to modify the axis title for this right Y-axis.

=======================
import originpro as op
import numpy as np

op.set_show(True)
book = op.new_book('w', 'MyBook')
wks = book.add_sheet('SPACE')

x = np.linspace(0, 10, 100)
y1 = np.sin(x)
y2 = np.cos(x) + 1

wks.from_list(0, x, 'Time')
wks.from_list(1, y1, 'Sin(x)')
wks.from_list(2, y2, 'Cos(x)')

graph = op.new_graph()
layer1 = graph[0]

plot1 = layer1.add_plot(wks, coly=1, colx=0)
plot1.color = (255, 0, 0)
plot1.name = 'Sine Curve'
layer1.lt_exec(f'set {plot1.name} -w 2000')

layer2 = graph.add_layer(2) # 2: right Y linked X scale
plot2 = layer2.add_plot(wks, coly=2, colx=0)
plot2.color = (0, 0, 255)
plot2.name = 'Cosine Curve'
layer2.lt_exec(f'set {plot2.name} -d 2')
layer2.lt_exec(f'set {plot2.name} -w 1000')

layer1.rescale()
layer2.rescale()

layer1.axis('x').title = 'Transient Time, sec.'
layer1.axis('x').limits = (0, 10, 1)
layer1.axis('y').title = 'Left value'
layer1.axis('y').limits = (-1.0, 1.0, 0.2)

layer2.axis('y').limits = (0, 2.0, 0.2)
layer2.axis('y').title = 'Right value'
2   L A T E S T    R E P L I E S    (Newest First)
sangjung Posted - 06/17/2025 : 6:07:36 PM
It works !!!
Thank you very much ^^
YimingChen Posted - 06/17/2025 : 08:59:58 AM
It seems the Python code does not support setting the right Y-axis title. As a workaround, you can use LabTalk to set the title. Please replace the last line with:
layer2.lt_exec('label -yr Right value')


James

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