[Matplotlib-users] histogram From: - 2006-05-26 16:19 ```Hi, just a small question about histogram. I saw that the result of the hist function from pylab and histogram from numpy+scipy can be slightly different when the array is big and with real data (not integer). I'll probably told something stupid but perhaps that will be good to have consistancies between both function, won't it? N. ```

[Matplotlib-users] histogram <humufr@ya...>
 Re: [Matplotlib-users] histogram From: John Hunter - 2006-05-26 16:23 ```>>>>> "humufr" == humufr writes: humufr> Hi, just a small question about histogram. I saw that the humufr> result of the hist function from pylab and histogram from humufr> numpy+scipy can be slightly different when the array is humufr> big and with real data (not integer). I'll probably told humufr> something stupid but perhaps that will be good to have humufr> consistancies between both function, won't it? Complete example, please... JDH ```

 Re: [Matplotlib-users] histogram From: - 2006-05-26 18:27 Attachments: data.dat ```Here a sample: the data are in the file data.dat join. In [1]: import pylab In [2]: import scipy In [3]: import scipy.stats In [4]: data1,data2=pylab.load('data.dat',unpack=True) In [5]: pylab.hist(data1,20) (Out[5]: array([ 4, 6, 23, 52, 90, 128, 184, 244, 283, 293, 297, 330, 321, 231, 188, 140, 94, 48, 29, 15]), array([ 0.00998046, 0.01054459, 0.01110872, 0.01167285, 0.01223698, 0.01280111, 0.01336524, 0.01392937, 0.0144935 , 0.01505763, 0.01562176, 0.01618589, 0.01675002, 0.01731415, 0.01787828, 0.01844241, 0.01900654, 0.01957067, 0.0201348 , 0.02069894]), ) In [6]: scipy.stats.histogram(data1,20) Out[6]: (array([ 1, 7, 17, 43, 75, 126, 185, 248, 303, 302, 314, 353, 315, 241, 178, 145, 70, 51, 20, 6]), 0.0096835454084847374, 0.00059382155039052636, 0) > humufr> Hi, just a small question about histogram. I saw that the > humufr> result of the hist function from pylab and histogram from > humufr> numpy+scipy can be slightly different when the array is > humufr> big and with real data (not integer). I'll probably told > humufr> something stupid but perhaps that will be good to have > humufr> consistancies between both function, won't it? > > Complete example, please... > > JDH > > > ------------------------------------------------------- > All the advantages of Linux Managed Hosting--Without the Cost and Risk! > Fully trained technicians. The highest number of Red Hat certifications in > the hosting industry. Fanatical Support. Click to learn more > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users ```

 Re: [Matplotlib-users] histogram From: Robert Kern - 2006-05-26 18:40 ```humufr@... wrote: > Hi, > > just a small question about histogram. I saw that the result of the hist > function from pylab and histogram from numpy+scipy can be slightly different > when the array is big and with real data (not integer). I'll probably told > something stupid but perhaps that will be good to have consistancies between > both function, won't it? There are lots of different, equally valid ways to construct a histogram. pylab.hist() and scipy.stats.histogram() probably use different algorithms. It's probably not worth changing one just to match the other. Much better would be to provide a broader interface to let the user twiddle the various knobs he would like to twiddle. I believe David Huard posted an improved histogram class that implements a number of useful features. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco ```

 Re: [Matplotlib-users] histogram From: David Huard - 2006-05-29 16:35 Attachments: Message as HTML ```Hum, I did, but it is still pretty rough. I did some changes to it a while ago t= o use objects and it still isn't complete. I'll try to get the class in working order by the weekend. Cheers, David ```

 Re: [Matplotlib-users] histogram From: David Huard - 2006-06-02 14:52 Attachments: Message as HTML      histogramc.py

 [Matplotlib-users] histogram From: jlu - 2008-02-04 17:28 Attachments: Picture 4.png      Message as HTML ```Are there any plans to add to hist() the ability to do non-bar style histograms? I mean something like the following: ```

 Re: [Matplotlib-users] histogram From: Pierre GM - 2008-02-04 17:48 ```On Monday 04 February 2008 12:28:21 jlu wrote: > Are there any plans to add to hist() the ability to do non-bar style > histograms? I mean something like the following: What about using plot w/ linestyle='steps' ? Or change the linewidth to 0 in bar ```

 Re: [Matplotlib-users] histogram From: jlu - 2008-02-04 18:26 ```linestyle='steps' only works for plot() not hist(). To use that, I have to generate points at the edges of each histogram step... this is what my custom code does now. IDL's histogram code does this automatically. Linewidth=0 doesn't work because it removes ALL lines. I also need fill=None and this added to linewidth=0 doesn't plot anything. Cheers, Jessica On Feb 4, 2008, at 9:42 AM, Pierre GM wrote: > On Monday 04 February 2008 12:28:21 jlu wrote: >> Are there any plans to add to hist() the ability to do non-bar style >> histograms? I mean something like the following: > > What about using plot w/ linestyle='steps' ? Or change the linewidth > to 0 in > bar > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > ```

 [Matplotlib-users] histogram From: Bala subramanian - 2009-03-30 15:25 Attachments: Message as HTML      1.dat      test.png

 Re: [Matplotlib-users] histogram From: Darren Dale - 2009-03-30 15:39 Attachments: Message as HTML ```On Mon, Mar 30, 2009 at 11:25 AM, Bala subramanian < bala.biophysics@...> 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. ```

 Re: [Matplotlib-users] histogram From: Bala subramanian - 2009-03-30 16:10 Attachments: Message as HTML ```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 wrote: > >> On Mon, Mar 30, 2009 at 11:25 AM, Bala subramanian < >> bala.biophysics@...> 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. >> > > ```

 Re: [Matplotlib-users] histogram From: Bala subramanian - 2009-03-30 16:11 Attachments: Message as HTML ```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 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 wrote: >> >>> On Mon, Mar 30, 2009 at 11:25 AM, Bala subramanian < >>> bala.biophysics@...> 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. >>> >> >> > ```

 Re: [Matplotlib-users] histogram From: Roban Hultman Kramer - 2009-03-30 16:33 Attachments: Message as HTML ```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@...> 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@...> 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 wrote: >>> >>>> On Mon, Mar 30, 2009 at 11:25 AM, Bala subramanian < >>>> bala.biophysics@...> 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@... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > ```