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
 How to add axis labels
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cts18488

United Kingdom
83 Posts

Posted - 06/20/2022 :  4:30:56 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 2021b and Service Release (Select Help-->About Origin): SR2
Operating System: Windows 10 Enterprise

Hi,

Can you please tell me what is the code to add an axis label? Also, I want to include in the label a variable from python (please see the example below)

x = 100
The axis label in python: "the grid separation is x meters"
and the following one to appear in Origin as an axis label: the grid separation is 100 meters.

Thank you,
Tibi

cts18488

United Kingdom
83 Posts

Posted - 06/20/2022 :  4:34:27 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
also, can you tell me how to specify which axis to use? X or Y axis.
quote:
Originally posted by cts18488

Origin Ver. 2021b and Service Release (Select Help-->About Origin): SR2
Operating System: Windows 10 Enterprise

Hi,

Can you please tell me what is the code to add an axis label? Also, I want to include in the label a variable from python (please see the example below)

x = 100
The axis label in python: "the grid separation is x meters"
and the following one to appear in Origin as an axis label: the grid separation is 100 meters.

Thank you,
Tibi

Go to Top of Page

cpyang

USA
1406 Posts

Posted - 06/20/2022 :  5:37:58 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I assume axis label you mean axis title?


import originpro as op
graph = op.new_graph(template='line')
gl = graph[0]
val=10
gl.axis('x').title = f'the grid separation is {val} meters'


CP
Go to Top of Page

cts18488

United Kingdom
83 Posts

Posted - 06/24/2022 :  12:10:33 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you!

And how can I make it bold? What would be the command?

Tibi
quote:
Originally posted by cpyang

I assume axis label you mean axis title?


import originpro as op
graph = op.new_graph(template='line')
gl = graph[0]
val=10
gl.axis('x').title = f'the grid separation is {val} meters'


CP


Go to Top of Page

cpyang

USA
1406 Posts

Posted - 06/24/2022 :  12:27:19 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by cts18488

Thank you!

And how can I make it bold? What would be the command?

Tibi




Bold etc are formatting escapes for any text labels on a graph, called Origin Rich Text, see

https://www.originlab.com/doc/en/Origin-Help/Escape-Sequences

So in the case above, you use


gl.axis('x').title = f'\\b(the grid separation is {val} meters)'


Double backslash is needed since Python is also using backslash for escape character.

CP
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