Hi,
I have a data set (number of dice thrown showing a particular number) and I'm trying to create a histogram of it. The data is stored in a text file, one trial per line, and I'm loading it using load().
Sample data:
12
17
8
12
11
16
It appears I need to group the data somehow into counts, eg:
8 : 1
9 : 0
10 : 0
11 : 1
12 : 2
and so on...
Is there a way to do this in matplotlib or am I missing something about hist() or one of the other functions?
Thanks,
Peter
In pylab: just choose the number of bins.
Hope this helps.
Alan Isaac
import pylab as P
help(P.hist)
Help on function hist in module matplotlib.pylab:
hist(*args, **kwargs)
HIST(x, bins=10, normed=0, bottom=0, orientiation='vertical', **kwargs)
Compute the histogram of x. bins is either an integer number of
bins or a sequence giving the bins. x are the data to be binned.
The return values is (n, bins, patches)
If normed is true, the first element of the return tuple will be the
counts normalized to form a probability distribtion, ie,
n/(len(x)*dbin)
orientation = 'horizontal' | 'vertical'. If horizontal, barh
will be used and the "bottom" kwarg will be the left.
kwargs are used to update the properties of the
hist bars
Addition kwargs: hold = [True|False] overrides default hold state
ยทยทยท