[Numpy-discussion] NumPy Histogram for Tentative NumPy Tutorial Questions
Wayne Watson
sierra_mtnview@sbcglobal....
Thu Nov 26 19:18:39 CST 2009
Yes, I'm just beginning to deal with the contents of NumPy, SciLab, and
SciPy. They all have seemed part of one another, but I think I see how
they've divided up the game. NumPy has no graphics. PyLab has them,
basically under matplotlib. histogram seems a bit odd to me. Here's
what I mean. I chopped some lines out of the other program:
import numpy
import pylab
#v = [5,5,2,2,2,6,4,4,3,3]
v=[1,2,3,4]
# Plot a normalized histogram
pylab.hist(v, bins=8, normed=1)
pylab.show()
If it's run, I would have expected 4 bars separated by the same
distance. The commented version of v is worse. It gives bar heights that
are of an even height. Using more bins gives some odd length bars. Maybe
an x row would help.
While I'm at it what's with the two arrows at the bottom and the cross?
I see the cross moves the drawing area, but does anyone really want to
do that? The arrows seem to only move the drawing area slightly. Zoom,
pencil, seems pretty offbeat.
Pauli Virtanen wrote:
> to, 2009-11-26 kello 15:08 -0800, Wayne Watson kirjoitti:
>
>> I guess the answer is easy about why a plot is not produced. The remark
>> in the histogram line says this will not work in numpy. Oh, well.
>>
>
> It works as it is intended to work. Numpy's histogram function just
> computes the histogram -- you have to plot it yourself.
>
> Indeed, the next two lines in the example use Matplotlib (ie. pylab) to
> plot the histogram.
>
>
--
Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
(121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet
350 350 350 350 350 350 350 350 350 350
Make the number famous. See 350.org
The major event has passed, but keep the number alive.
Web Page: <www.speckledwithstars.net/>
More information about the NumPy-Discussion
mailing list