histogram

Darren,
But y axis goes scale is than one when i use normed=1. I am not getting why this happens.

Friends,

I tried to plot a histogram and pdf of my data (data file attached 1.dat). When i see the figure (attached file test.png) , i see y axis more than 1 (although it should not when i use normed=1. I am not getting why this happens.

Somebody kindly write me i) Why the y-axis scales more than 1 ii) after plotting histogram and pdf, how to delete the histogram and show only the normal curve.

The following are the commands i used.
data=load(‘1.dat’)

x=[:,1]
mu=mean(x);st=std(x)
n,bins,patch=hist(x,50,normed=1,histtype=‘stepfilled’)

y = normpdf( bins, mu, st)
plot(bins, y, ‘k–’, linewidth=1.5)

hist plots a distribution whose integral is 1.

···

On Mon, Mar 30, 2009 at 5:39 PM, Darren Dale <dsdale24@…287…> wrote:

On Mon, Mar 30, 2009 at 11:25 AM, Bala subramanian <bala.biophysics@…287…> wrote:

There was a typo in my previous mail.
y axis goes scale is more than one when i use normed=1. I am not getting why this happens.

···

On Mon, Mar 30, 2009 at 6:10 PM, Bala subramanian <bala.biophysics@…287…> wrote:

Darren,
But y axis goes scale is than one when i use normed=1. I am not getting why this happens.

On Mon, Mar 30, 2009 at 5:39 PM, Darren Dale <dsdale24@…287…> wrote:

On Mon, Mar 30, 2009 at 11:25 AM, Bala subramanian <bala.biophysics@…287…> wrote:

Friends,

I tried to plot a histogram and pdf of my data (data file attached 1.dat). When i see the figure (attached file test.png) , i see y axis more than 1 (although it should not when i use normed=1. I am not getting why this happens.

Somebody kindly write me i) Why the y-axis scales more than 1 ii) after plotting histogram and pdf, how to delete the histogram and show only the normal curve.

The following are the commands i used.
data=load(‘1.dat’)

x=[:,1]
mu=mean(x);st=std(x)
n,bins,patch=hist(x,50,normed=1,histtype=‘stepfilled’)

y = normpdf( bins, mu, st)
plot(bins, y, ‘k–’, linewidth=1.5)

hist plots a distribution whose integral is 1.

As Darren said, normed=1 means that the integral of the histogram is normalized to one, not the height. In other words, the total area under the histogram curve is set to one.

Imagine a histogram with a single bin. If the width of the bin is less than one, the height must be greater than one in order for the area to equal one. Therefore the y-axis scale can be greater than one even when normed=1.

-Roban

···

On Mon, Mar 30, 2009 at 12:11 PM, Bala subramanian <bala.biophysics@…287…> wrote:

There was a typo in my previous mail.
y axis goes scale is more than one when i use normed=1. I am not getting why this happens.

On Mon, Mar 30, 2009 at 6:10 PM, Bala subramanian <bala.biophysics@…120…287…> wrote:

Darren,
But y axis goes scale is than one when i use normed=1. I am not getting why this happens.

On Mon, Mar 30, 2009 at 5:39 PM, Darren Dale <dsdale24@…287…> wrote:

On Mon, Mar 30, 2009 at 11:25 AM, Bala subramanian <bala.biophysics@…287…> wrote:

Friends,

I tried to plot a histogram and pdf of my data (data file attached 1.dat). When i see the figure (attached file test.png) , i see y axis more than 1 (although it should not when i use normed=1. I am not getting why this happens.

Somebody kindly write me i) Why the y-axis scales more than 1 ii) after plotting histogram and pdf, how to delete the histogram and show only the normal curve.

The following are the commands i used.
data=load(‘1.dat’)

x=[:,1]
mu=mean(x);st=std(x)
n,bins,patch=hist(x,50,normed=1,histtype=‘stepfilled’)

y = normpdf( bins, mu, st)
plot(bins, y, ‘k–’, linewidth=1.5)

hist plots a distribution whose integral is 1.



Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users