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
 add_plot() How to plot all the data in the sheet

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
maniubi Posted - 04/18/2023 : 07:30:09 AM
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

6   L A T E S T    R E P L I E S    (Newest First)
maniubi Posted - 04/19/2023 : 10:06:50 PM
Thank you for your help. I will try testing on origin2023
YimingChen Posted - 04/19/2023 : 2:21:47 PM
Yes. Please upgrade to Origin 2023 for testing.

maniubi Posted - 04/19/2023 : 09:53:50 AM
The script I used for origin2021 testing,Can it only use origin2023
YimingChen Posted - 04/19/2023 : 08:54:45 AM
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
maniubi Posted - 04/18/2023 : 11:04:31 PM
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


YimingChen Posted - 04/18/2023 : 11:08:57 AM
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

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