In the example you provide, bins is returned by the hist command,
whereas in your code, bins is a number that you defined as 20. So,
change:
bins = 20
plt.hist(C, bins, ...
by:
nbins = 20
n, bins, patches = plt.hist(C, nbins, ...
As a side comment, your data loading is too complex, and fail
Hi David,
I tried your fix
nbins = 20
n, bins, patches = plt.hist(C, nbins, range=None, normed=False,
weights=None, cumulative=False, bottom=None, histtype='bar', align='mid',
orientation='vertical', rwidth=None, log = False, color=None, label=None)
plt.title()
plt.text(25,20,'M -21.5' '\n'
Just tried it with nbins set to 216 and I still get the error
surfcast23 wrote:
Hi David,
I tried your fix
nbins = 20
n, bins, patches = plt.hist(C, nbins, range=None, normed=False,
weights=None, cumulative=False, bottom=None, histtype='bar', align='mid',
On Fri, Jul 27, 2012 at 9:57 PM, surfcast23 surfcas...@gmail.com wrote:
y = mlab.normpdf( nbins, avg, sigma)
l = plt.plot(nbins, y, 'r--', linewidth=1)
plt.show()
You should not change bins there, as you are evaluating the gaussian
function at different values.
Also, sigma is a vector, but it
Thanks for catching that sigma was still a vector! I am no longer getting the
errors, but the best fit line is not showing up.Is there something else I am
missing ?
BTW thanks for the heads up on the np.mean and np.standard functions.
Khary
Daπid wrote:
On Fri, Jul 27, 2012 at 9:57 PM,
I guess it is showing, but you have many data points, so the gaussian
is too small down there. You have to increase its values to make both
areas fit:
plt.plot(bins, N*(bins[1]-bins[0])*y, 'r--', linewidth=1)
And you will get a nice gaussian fitting your data.
On Fri, Jul 27, 2012 at 11:12 PM,
That worked beautifully thank you!
Am I reading (bins[1]-bins[0]) correctly as taking the difference between
what is in the second and first bin?
Daπid wrote:
I guess it is showing, but you have many data points, so the gaussian
is too small down there. You have to increase its values to
On Sat, Jul 28, 2012 at 12:22 AM, surfcast23 surfcas...@gmail.com wrote:
Am I reading (bins[1]-bins[0]) correctly as taking the difference between
what is in the second and first bin?
Yes. I am multipliying the width of the bins by their total height.
Surely there are cleaner and more general
Thank you for the help!
Daπid wrote:
On Sat, Jul 28, 2012 at 12:22 AM, surfcast23 surfcas...@gmail.com wrote:
Am I reading (bins[1]-bins[0]) correctly as taking the difference
between
what is in the second and first bin?
Yes. I am multipliying the width of the bins by their total
Hi
I have a code to plot a histogram and I am trying to add a best fit line
following this example
http://matplotlib.sourceforge.net/examples/pylab_examples/histogram_demo.html
but run into this error
Traceback (most recent call last):
File /home/Astro/count_Histogram.py, line 54, in module
Hi List
I cannot figure out how to satisfy this issue to resolve the ValueError:
x and y must have same first dimension.
This is the relevant code:
[code]
for i in range( 0, time + 1 ):
outflow = constant * quantity
quantityChange = inflow - outflow
changeList.append(
On Sun, Mar 21, 2010 at 1:57 PM, AG computing.acco...@googlemail.comwrote:
Hi List
I cannot figure out how to satisfy this issue to resolve the ValueError:
x and y must have same first dimension.
This is the relevant code:
[code]
for i in range( 0, time + 1 ):
outflow = constant *
12 matches
Mail list logo