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.
Are there any plans to add to hist() the ability to do non-bar style histograms? I mean something like the following:
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
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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
>>>>> "humufr" == humufr <hu...@ya...> 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
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]), <a list of 20 Patch objects>) 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
hu...@ya... 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
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