Hi Jerome,

although your problem seems to solved, I would like to state a small remark 
about the different number of bins. Some time ago numpy changed the default 
of using left bin edges to using all bin edges. Newer versions of matplotlib 
handle this difference pretty well, but maybe your old version didn't know 
about this quite new numpy feature. I faced this problem some month ago as an 
old script got sticked and raised some weird error. As Sandro suggested the 
best way is to update matplotlib.

best regards Matthias


On Monday 22 June 2009 13:33:46 jmariette wrote:
> Hi everybody,
> I have some probleme with Matplot/numpy !
> I'm using matplot v0.91.2 and I'm trying to get the hist function working
> !!
>
> I'm using the sample code of matplot:
>
> ----------------------------------------------------------
> #!/usr/bin/env python
> import numpy as np
> import matplotlib.mlab as mlab
> import matplotlib.pyplot as plt
>
> mu, sigma = 100, 15
> x = mu + sigma*np.random.randn(10000)
>
> # the histogram of the data
> n, bins, patches = plt.hist(x, 50, normed=1, facecolor='green', alpha=0.75)
>
> print len(n)
> print len(bins)
>
> print n
> print bins
>
> # add a 'best fit' line
> y = mlab.normpdf( bins, mu, sigma)
> l = plt.plot(bins, y, 'r--', linewidth=1)
>
> plt.xlabel('Smarts')
> plt.ylabel('Probability')
> plt.title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$')
> plt.axis([40, 160, 0, 0.03])
> plt.grid(True)
>
> plt.show()
> ------------------------------------------------------------
>
> With the same matplot lib but a different version of numpy I get 2
> different number of bins !!! How is that possible ???
> using the 1.0.4 version of numpy, I get len(n) = 50 and len(bins) = 50 ...
> what sounds pretty right to me !! but using the version 1.2.1 (the last one
> I guess) I got len(n) = 50 and len(bins) = 51 What looks weird, doesn't it
> ???
>
> do you guys have an explanation ??
> Anybody faced the same problem ?
>
> thx, Jerome



------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have 
the opportunity to enter the BlackBerry Developer Challenge. See full prize 
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to