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 can I adjust line width in plots?

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
sebae Posted - 07/22/2021 : 05:51:42 AM
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?
2   L A T E S T    R E P L I E S    (Newest First)
cpyang Posted - 07/22/2021 : 6:20:21 PM

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
sebae Posted - 07/22/2021 : 08:34:50 AM
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.


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