Reputation: 3347
I would like to draw graphs like this (Sorry, I was not able to upload the picture) http://www.organizationview.com/wp-content/uploads/2011/01/Stacked-distribution.jpg
Which software can do this? Is there any python utilities that can do this?
Upvotes: 0
Views: 323
Reputation: 4668
I made you a working matplotlib example. I only made three components per bar-chart. Adding two more for the five total in your example is left as an exercise to the reader. :) The code is quoted down below. You can also see it live or download my IPython notebook: http://nbviewer.ipython.org/5852773
import numpy as np
import matplotlib.pyplot as plt
width=0.5
strong_dis = np.array((20, 10, 5, 10, 15))
disagree = np.array((20, 25, 15, 15, 10))
# shortcut here
therest = np.subtract(100, strong_dis + disagree)
q = np.arange(5)
bsd=plt.barh(q, strong_dis, width, color='red')
bd=plt.barh(q, disagree, width, left=strong_dis, color='pink')
br=plt.barh(q, therest, width, left=strong_dis+disagree, color='lightblue')
ylabels = tuple(reversed(['A', 'B', 'C', 'D', 'E']))
plt.yticks(q+width/2., ylabels)
plt.xlabel('Responses (%)')
plt.legend((bsd, bd, br), ('strong disagree', 'disagree', 'the rest'))
plt.show()
Upvotes: 1
Reputation: 13907
Have a look at matplotlib. They have an examples section, which includes a stacked bar chart.
Upvotes: 0
Reputation: 13108
The matplotlib library can be used for generating graphs in Python. http://matplotlib.org/
Upvotes: 0