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 can I adjust line width in plots?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

sebae

5 Posts

Posted - 07/22/2021 :  05:51:42 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 2021b (64-bit) SR1 9.8.5.204
Operating System: Embedded Python

It seems there is no function in the API to adjust line width in plots like plot.linewidth(value).

I have found LabTalk offers it as: set %c -c 5

So I tried in the Python console similarly like,

gr.lt_exec('layer.plot=1') # 'gr' is a GPage object.
gr.lt_exec('set %c -c 5')

This works fine only when I activate the graph manually by clicking it in the OriginPro itself. I guess it was activated already by the first line.

Is there any other good way to select and adjust plot?

Edited by - sebae on 07/22/2021 05:52:54 AM

sebae

5 Posts

Posted - 07/22/2021 :  08:34:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I got some progress by myself.
Let 'pl' is a plot object then,

originpro.lt_exec(f'win -a {pl.layer.GetPage()}') # The graph is activated
originpro.lt_exec(f'layer.plot={pl.index()+1}')
originpro.lt_exec('set %c -w 5000')

But how can I specify an index of the layer?

This must be quite easy question but please understand that I have no idea on LabTalk at all.

Go to Top of Page

cpyang

USA
1406 Posts

Posted - 07/22/2021 :  6:20:21 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply

wks=op.find_sheet()
graph = op.new_graph(template='line')
gl=graph[0]
p1 = gl.add_plot(wks, 2, 0)
p2 = gl.add_plot(wks, 3, 0)
#actual usful code starts here
layr = op.GLayer(p2.layer)
pindex = p2.index()
pname = layr.obj.GetStrProp(f'plot{pindex+1}.name')
layr.lt_exec(f'set {pname} -w 5000')


set command first argument is an internal dataset name, which can be obtained from LT by layer.plot2.name$, so once you have that you can execute in the layer context any of those set commands.

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