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
 Can't plot 8x12 graphs using template

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
cts18488 Posted - 01/20/2023 : 10:49:48 AM
Origin Ver. 2021b and Service Release (Select Help-->About Origin):
Operating System: Win 10 ent

Hi,

I am trying to plot a 8x12 plots (see picture attached) using originpro module in python and a template. However, when the software is trying to plot the graph I get the following error:
gl_0 = gr1[0]
TypeError: 'NoneType' object is not subscriptable

If I try a 4x4 plot, everything is working fine. Appreciate any help.

The code is below:


def origin_shutdown_exception_hook(exctype, value, traceback):
    '''Ensures Origin gets shut down if an uncaught exception'''
    op.exit()
    sys.__excepthook__(exctype, value, traceback)
if op and op.oext:
    sys.excepthook = origin_shutdown_exception_hook

if op.oext:
    op.set_show(True)

wks = op.new_sheet(lname = 'HTCD') # for normal plots
wks.name = 'HTCD'

wks.from_list(0, htcd_file[0], lname='Wavelength', units='nm')

for i in range(1, 97):
    wks.from_list(i, htcd_file[i], lname=f'{i}', comments=f'spectrum {i}')


path_template = os.getcwd()

new_path_template = path_template.replace('/', '\\')

gr1 = op.new_graph(template=(new_path_template + '\\Origin templates\\htcd.otpu'), lname='HTCD')
      
gl_0 = gr1[0]
g0 = gl_0.add_plot(wks, coly='B', colx='A', type=202)

gl_1= gr1[1]
p1 = gl_1.add_plot(wks, coly='C', colx='A', type=202)



3   L A T E S T    R E P L I E S    (Newest First)
cts18488 Posted - 01/23/2023 : 09:08:18 AM
I have solved the problem. The issue was related with the current directory hence the graph template was not read. Sorry and thank you for your help.
quote:
Originally posted by cts18488

Origin Ver. 2021b and Service Release (Select Help-->About Origin):
Operating System: Win 10 ent

Hi,

I am trying to plot a 8x12 plots (see picture attached) using originpro module in python and a template. However, when the software is trying to plot the graph I get the following error:
gl_0 = gr1[0]
TypeError: 'NoneType' object is not subscriptable

If I try a 4x4 plot, everything is working fine. Appreciate any help.

The code is below:


def origin_shutdown_exception_hook(exctype, value, traceback):
    '''Ensures Origin gets shut down if an uncaught exception'''
    op.exit()
    sys.__excepthook__(exctype, value, traceback)
if op and op.oext:
    sys.excepthook = origin_shutdown_exception_hook

if op.oext:
    op.set_show(True)

wks = op.new_sheet(lname = 'HTCD') # for normal plots
wks.name = 'HTCD'

wks.from_list(0, htcd_file[0], lname='Wavelength', units='nm')

for i in range(1, 97):
    wks.from_list(i, htcd_file[i], lname=f'{i}', comments=f'spectrum {i}')


path_template = os.getcwd()

new_path_template = path_template.replace('/', '\\')

gr1 = op.new_graph(template=(new_path_template + '\\Origin templates\\htcd.otpu'), lname='HTCD')
      
gl_0 = gr1[0]
g0 = gl_0.add_plot(wks, coly='B', colx='A', type=202)

gl_1= gr1[1]
p1 = gl_1.add_plot(wks, coly='C', colx='A', type=202)





cts18488 Posted - 01/21/2023 : 3:11:30 PM
Here it is the template
quote:
Originally posted by YimingChen

I couldn't reproduce the issue. Can you share the graph template (htcd.otpu) for us to test? Thanks.

James

https://my.originlab.com/ftp/forum_and_kbase/Images/htcd.otpu
YimingChen Posted - 01/20/2023 : 3:06:23 PM
I couldn't reproduce the issue. Can you share the graph template (htcd.otpu) for us to test? Thanks.

James

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