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
 Origin Forum
 Create stack graph in python originpro
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Tao_Zhang

China
2 Posts

Posted - 01/13/2025 :  4:11:55 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I'm trying to write a python script to plot in origin using originpro package. I use the following line to create a stack graph.

graph = op.new_graph(template='stack')

When I create the graph using the above line, it has only one layer. I use the graph.add_layer() function to add more layers, but it messy.

How can I specify the number of layers in the stack graph so that it can organize the layout correctly when creating the graph?

NicholasSupport

USA
64 Posts

Posted - 01/13/2025 :  9:04:02 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello Tao_Zhang,

I think it will be less messy to use the 'plotstack' X-Function via lt_exec.

This will let you specify the X and Y pairs and allow you to use all the options that come with the X-Function itself.

import os
import originpro as op

wks = op.new_sheet()
wks.from_file(os.path.join(op.path('e'), 'Samples', 'Graphing', 'Group.dat'))
wks.lt_exec('plotstack iy:=((1,2), (1,3), (1,4))')


For more information on the 'plotstack' X-Function, visit this page:
https://www.originlab.com/doc/X-Function/ref/plotstack

Let me know if this is an appropriate solution for your scenario, and if any other questions arise.

Best,

Nicholas G.
nicholas@originlab.com
OriginLab Technical Support Team
Go to Top of Page

Tao_Zhang

China
2 Posts

Posted - 01/14/2025 :  12:15:52 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you so much, Nicholas! It's perfect for me.

quote:
Originally posted by NicholasSupport

Hello Tao_Zhang,

I think it will be less messy to use the 'plotstack' X-Function via lt_exec.

This will let you specify the X and Y pairs and allow you to use all the options that come with the X-Function itself.

import os
import originpro as op

wks = op.new_sheet()
wks.from_file(os.path.join(op.path('e'), 'Samples', 'Graphing', 'Group.dat'))
wks.lt_exec('plotstack iy:=((1,2), (1,3), (1,4))')


For more information on the 'plotstack' X-Function, visit this page:
https://www.originlab.com/doc/X-Function/ref/plotstack

Let me know if this is an appropriate solution for your scenario, and if any other questions arise.

Best,

Nicholas G.
nicholas@originlab.com
OriginLab Technical Support Team

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