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
 Line width and addline
 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 - 11/15/2021 :  12:40:06 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 2021b and Service Release SR2 (Select Help-->About Origin):
Operating System: Win10 Ent

Hi,

Is it possible to change the line width of a graph using External Python? Also, can a straight line be inserted with a command line like in this example: https://www.originlab.com/doc/X-Function/ref/addline?

Thank you,
Tibi

YimingChen

1621 Posts

Posted - 11/15/2021 :  2:00:17 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
1. To set line width:
plot.set_int('line.width', 6)

2. To run Xfunction from Python, try:
op.lt_exec("addline type:=1 value:=12 select:=1 name:=vline1;")


James
Go to Top of Page

cts18488

United Kingdom
83 Posts

Posted - 11/15/2021 :  3:18:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It worked to change the line width. However, the second option, did not work. This is what I have tried:

gl_1 = gr[0]
p1 = gl_1.add_plot(wks, 1, 0, type=230) # X is col A, Y is col B. 202 is Line + Symbol.
p1.set_int('line.width', 10) # set the line width
op.lt_exec("addline type:=1 value:=0 select:=1 name:=hline1;")

gl_1.rescale()

I want an horizontal line at value 0.

Thank you,
Tibi

quote:
Originally posted by YimingChen

1. To set line width:
plot.set_int('line.width', 6)

2. To run Xfunction from Python, try:
op.lt_exec("addline type:=1 value:=12 select:=1 name:=vline1;")


James

Go to Top of Page

YimingChen

1621 Posts

Posted - 11/15/2021 :  5:18:36 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You may need to specify the graph layer to run the LT script, the the script below:
gl_1.lt_exec("addline type:=1 value:=12 select:=1 name:=vline1;")


James
Go to Top of Page

cts18488

United Kingdom
83 Posts

Posted - 11/16/2021 :  08:08:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I have tried that and it still doesn't work.

quote:
Originally posted by YimingChen

You may need to specify the graph layer to run the LT script, the the script below:
gl_1.lt_exec("addline type:=1 value:=12 select:=1 name:=vline1;")


James

Go to Top of Page

cpyang

USA
1406 Posts

Posted - 11/16/2021 :  4:10:09 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
If you just need to show a horizontal line at Y=0, you can turn it on from GUI and save into your template.




CP
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 11/16/2021 :  4:19:31 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can control such axes properties with set_int, like


gl_1.set_int("x.AtZero",1)


Details on such LabTalk properties can be found at

https://www.originlab.com/doc/LabTalk/ref/Layer-Axis-obj

CP
Go to Top of Page

cts18488

United Kingdom
83 Posts

Posted - 11/16/2021 :  5:26:10 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you! It's working!

Appreciate your help!

I prefer this way as I want to add the zero line when certain conditions are met.

quote:
Originally posted by cpyang

You can control such axes properties with set_int, like


gl_1.set_int("x.AtZero",1)


Details on such LabTalk properties can be found at

https://www.originlab.com/doc/LabTalk/ref/Layer-Axis-obj

CP



Edited by - cts18488 on 11/16/2021 5:27:36 PM
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