[Numpy-discussion] NumPy Histogram for Tentative NumPy Tutorial Questions
josef.pktd@gmai...
josef.pktd@gmai...
Thu Nov 26 20:48:28 CST 2009
On Thu, Nov 26, 2009 at 8:18 PM, Wayne Watson
<sierra_mtnview@sbcglobal.net> wrote:
> 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.
Do you mean this http://matplotlib.sourceforge.net/users/navigation_toolbar.html
Zoom is convenient when you have for example a thousand points with
lots of variation in one graph.
Browsing some examples in the matplotlib docs might be useful to get a
basic idea of it
e.g http://matplotlib.sourceforge.net/gallery.html
The main docs for numpy scipy start here http://docs.scipy.org/doc/
many/most of the numpy functions have by now examples in the reference
guide and docstrings and might be more up to date than the tutorial.
It might be helpful to browse them in parallel to the tutorial.
Josef
>
> 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/>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
More information about the NumPy-Discussion
mailing list