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
 python box plot with selected columns
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

syxz0628

China
4 Posts

Posted - 03/29/2023 :  04:53:26 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): OriPro2022
Operating System:windows10
I want to use python to generate a box plot.
The selection of column and rows is not clear to me.I have tried using column number, it works, although, I can only add_plot one by one.
plot = glayer.add_plot(f'{wks.lt_range()}!(,10)[:]')
plot = glayer.add_plot(f'{wks.lt_range()}!(,11)[:]')
however, I want to select specific columns with string 'RWS' in the longname.
How could I achieve it.
Thanks.

YimingChen

1486 Posts

Posted - 03/29/2023 :  09:04:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can loop through the columns, and check and add 'RWS' columns. See the sample code:

import originpro as op
wks = op.find_sheet();
glayer = op.new_graph(template='box.otpu')[0]
for i in range(wks.cols):
    if wks.get_label(i) == 'RWS':
        plot = glayer.add_plot(wks, i)


James
Go to Top of Page

posseportray

United Kingdom
1 Posts

Posted - 11/27/2023 :  04:58:32 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Your solution worked perfectly for me. Thank you!
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