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
 add_plot() How to plot all the data in the sheet
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

maniubi

China
4 Posts

Posted - 04/18/2023 :  07:30:09 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin):
Operating System:

p1 = gl_1.add_plot(wks) I want to make all the data in the sheet (5 groups of data, xy) on the graph, how to operate,

plot = gl.add_plot(f'{wks.lt_range()}!(?,1:end)')
And,I don't know what that means(f'{wks.lt_range()}!(?,1:end)')
and,it doesn't work

f'{wks.lt_range()}!(?,1:end)'------Report an error
How to write the correct range


Edited by - maniubi on 04/18/2023 10:08:51 AM

YimingChen

1618 Posts

Posted - 04/18/2023 :  11:08:57 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Could you please provide the entire script? The script you provided below worked for me to add multiple xy data to the graph simultaneously.
plot = gl.add_plot(f'{wks.lt_range()}!(?,1:end)')


James
Go to Top of Page

maniubi

China
4 Posts

Posted - 04/18/2023 :  11:04:31 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you for your answer. This is an official example that I copied, but it doesn't work (during drawing),

wks = op.new_sheet()
wks.from_file(os.path.join(op.path('e'), 'Samples', 'Graphing', 'Group.dat'))
graph = op.new_graph(template='scatter')
gl=graph[0]

# plot whole sheet as XY plot
plot = gl.add_plot(f'{wks.lt_range()}!(?,1:end)')

# group the plots and control plots setting in group
gl.group()
plot.colormap = 'Candy'
plot.shapelist = [3, 2, 1]
gl.rescale()


# Exit running instance of Origin.
# Required for external Python but don't use with embedded Python.
if op.oext:
op.exit()

How to determine the scope using this method,(f'{wks.lt_range()}!(?,1:end)')




Afterwards, I tried and found that if I replaced (?, 1: end) with (?, 2) or (?, 4), it would work normally, but only one xy data would work. I want more sets of data (8 xy), or more, so how do I represent it



Edited by - maniubi on 04/18/2023 11:31:36 PM
Go to Top of Page

YimingChen

1618 Posts

Posted - 04/19/2023 :  08:54:45 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Have you used Origin 2023 to test the script? Here the input will resolve to [Book1]Group!(?,1:end), where '?' indicates that the range is forced to use worksheet designation, and '1:end' indicates all y columns are plotted.

James
Go to Top of Page

maniubi

China
4 Posts

Posted - 04/19/2023 :  09:53:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The script I used for origin2021 testing,Can it only use origin2023

Edited by - maniubi on 04/19/2023 09:55:47 AM
Go to Top of Page

YimingChen

1618 Posts

Posted - 04/19/2023 :  2:21:47 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Yes. Please upgrade to Origin 2023 for testing.

Go to Top of Page

maniubi

China
4 Posts

Posted - 04/19/2023 :  10:06:50 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you for your help. I will try testing on origin2023
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