0

I have a stackplot in Excel as shown below. I'm trying to generate the same plot using Python.

enter image description here

My code for the same is below.

x = ['d1','d2','d3','d4','d5']
labels = ['a','b','c','d','e']
sns.set(font_scale = 1.25)
plt.stackplot(x,gA,gB,gC,gD,gE,labels=labels) #gA,...,gE stores the percentage values
plt.legend(loc='upper left')
plt.title('Reason')
plt.show()

A sample y - gB looks like below

+---+--------+
|   | Reason |
+---+--------+
| a |      4 |
| b |     32 |
| c |      4 |
| d |     56 |
| e |      4 |
+---+--------+

I get a really strange plot when I run this.

enter image description here

What am I missing out?

srkdb
  • 775
  • 3
  • 15
  • 28

0 Answers0