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 type and line color
 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
82 Posts

Posted - 01/09/2024 :  09:48:47 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

I am trying to plot 2 workbooks in one graph, each workbook with its one colour and type. For example, first plot from first workbook to be red and solid line, the first plot from second workbook to be still red, but dash line; second plot from first workbook to be blue and solid line, the second plot from second workbook to be still blue, but dash line.

This is what I am trying
gl_ind_ORD = gr4[0]
p1_ind_ORD = gl_ind_ORD.add_plot(f'{wks_ORD.lt_range()}!(?,1:end)')
p1_ind_ORD_KK = gl_ind_ORD.add_plot(f'{wks_ORD_indCB_KK.lt_range()}!(?,1:end)')
p1_ind_ORD.set_int('line.width', 8)
p1_ind_ORD_KK.set_int('line.width', 8)
gl_ind_ORD.axis('y').title = f'\\b(CB-KK ({units}))'
gl_ind_ORD.group()
p1_ind_ORD.colormap = 'Candy'
p1_ind_ORD_KK.colormap = 'Candy'
gl_ind_ORD.rescale()
gl_ind_ORD.xlim = (min(csv_file['Wavelength']), max(csv_file['Wavelength']))

However, I wasn't able to get what I want.

For dash line, I have tried multiple codes, but none of them worked.
p1_ind_ORD.set_int('line.type', 2)
gl_ind_ORD.set_int('p1_ind_ORD.type', 2)

ChaoC

USA
174 Posts

Posted - 01/09/2024 :  10:30:13 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

Have you tried the set_cmd() function? It executes the LabTalk set command.

https://docs.originlab.com/originpro/classoriginpro_1_1graph_1_1Plot.html#a5a2b679b5067a02176bdbaa08f3b8487

https://www.originlab.com/doc/Labtalk/Ref/Set-cmd

Best,
Chao
Go to Top of Page

cts18488

United Kingdom
82 Posts

Posted - 01/09/2024 :  12:19:03 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I have tried the set_cmd as well, but still does not work.

It seems that the plots are interlinked. The second plot takes all the parameters from the first. If the first plot is red and solid line the will have the same attributes. I have tried to take out .group() but this does not solve the issue.

Can you please help on this matter?

Thanks!
quote:
Originally posted by ChaoC

Hello,

Have you tried the set_cmd() function? It executes the LabTalk set command.

https://docs.originlab.com/originpro/classoriginpro_1_1graph_1_1Plot.html#a5a2b679b5067a02176bdbaa08f3b8487

https://www.originlab.com/doc/Labtalk/Ref/Set-cmd

Best,
Chao


Edited by - cts18488 on 01/09/2024 12:20:36 PM
Go to Top of Page

ChaoC

USA
174 Posts

Posted - 01/09/2024 :  2:56:55 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

Could you check out this thread?
https://my.originlab.com/forum/topic.asp?TOPIC_ID=48121

Best,
Chao
Go to Top of Page

cts18488

United Kingdom
82 Posts

Posted - 01/09/2024 :  6:48:12 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I manage to solve that one. There were some strange settings on the template, which I fix it.

Now, I am trying to plot independently each plot using a for function. However, when I try to use set_int or set_cmd, there is an error "'list' object has no attribute 'set_int'". Do you know how can I can overcome this?

This is the code I am using:
gl_ind_ORD = [gr4 for i in range(3)] #gr4 has only 3 graphs
p1_ind_ORD_old = ['' for i in range(number_of_spectra)]
p1_ind_ORD_KK_old = ['' for i in range(number_of_spectra)]

p1_ind_ORD_old[0] = gl_ind_ORD[0].add_plot(wks_ORD, coly='B', colx='A')
p1_ind_ORD_old[0].set_int('line.width', 8)

Type of p1_ind_ORD_old[0] is <class 'originpro.graph.Plot'> so I don't understand the error is present.

Thank you,
Tibi

quote:
[i]Originally posted by ChaoC


Hello,

Could you check out this thread?
https://my.originlab.com/forum/topic.asp?TOPIC_ID=48121

Best,
Chao

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