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
 How to generate stacked column plot?

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
ChemistryGuy Posted - 03/01/2023 : 6:18:41 PM
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 2023 (64-bit) Beta7
Operating System: Windows 11

I am trying to use Python to generate a stacked column (aka stacked bar) graph, using a template I have made. However, I am having trouble working out the correct way to import the data to accomplish this.

If I use Code Sample 1 (shown below), the two columns are plotted superimposed on each other (rather than stacked). If I use Code Sample 2 (shown below) the two columns are plotted side-by-side rather than stacked.

If anyone knows how to do this such that the columns appear stacked, please would you advise me?

Code Sample 1
gl.add_plot(data_wks, coly=1, colx=0, type='?')
gl.add_plot(data_wks, coly=2, colx=0, type='?')

Code Sample 2
gl.add_plot(data_wks, coly=1, colx=0, type='?')
gl.add_plot(data_wks, coly=2, colx=0, type='?')
gl.group(True, 0, 1)
6   L A T E S T    R E P L I E S    (Newest First)
ChemistryGuy Posted - 03/17/2023 : 4:39:45 PM
Thank you very much, I tried this and it worked perfectly!
YimingChen Posted - 03/15/2023 : 11:17:42 AM
gl.lt_exec('set %C -vg 40')

Here 40 is the percentage gap.

James
kartridzhej Posted - 03/15/2023 : 05:35:13 AM
A follow up question: Is it possible to change the column spacing using Python?
ChemistryGuy Posted - 03/15/2023 : 04:54:52 AM
A follow up question: Is it possible to change the column spacing using Python?
ChemistryGuy Posted - 03/02/2023 : 5:51:06 PM
I gave this a try and it worked perfectly, thank you very much!

Also, in case it helps anyone else, the code that worked for me was slightly different to that which was provided:

gl.lt_exec('layer -b s 1')
YimingChen Posted - 03/02/2023 : 11:56:18 AM
Could you add one line after code sample 2 to set the plots to stack cumulatively?
op.lt_exec('layer -b s 1')


James

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