Reputation: 4615
it's my first time using python. I want to plot a histogram based on a simple data set stored in a dictionary as follows:
x = {'2010': [2,555,11], '2011': [1, 777, 12], ...}
as you can see, there would be three data values each bin.
It's easy to make a plot based on only one data, but how to handle this case?
Thanks a lot
Upvotes: 0
Views: 2390
Reputation: 8400
n, bins, patches = pylab.hist(x, 10, normed=1, histtype='bar', stacked=True)
Follow the example given in this {matplotlib example page}, it is very helpful.
Simple Example:
import numpy as np
import pylab as pl
x = np.random.rand(100,3)
pl.hist(x,stacked=True)
pl.show()
Upvotes: 1