[Tutor] How to do histogram

Kent Johnson kent37 at tds.net
Thu Oct 4 23:30:58 CEST 2007


Fangwen Lu wrote:
> Dear all-
>  
> I want to get a histogram. And I did the following.
> from pylab import *
> x=(1,1,2,2,2,2,3,4)
> hist(x)
>  
> Then I get
> (array([2, 0, 0, 4, 0, 0, 1, 0, 0, 1]), array([ 1. ,  1.3,  1.6,  1.9,  
> 2.2,  2.5,  2.8,  3.1,  3.4,  3.7]), <a list of 10 Patch objects>)
>  
> But actually I want to get a picture.
> What's the problem? What should I do?

Did you call show() ? There is a histogram example here:
http://matplotlib.sourceforge.net/screenshots.html

Kent


More information about the Tutor mailing list