[Tutor] Looping over histogram plots

Elaina Ann Hyde elainahyde at gmail.com
Wed Jun 27 01:32:36 CEST 2012

Dear Don,
    Thanks for the comment, the set type is no problem for me, this is just
a variable that I call set... and it works great for my purposes, I do
suspect it is something in the way that matplotlib/pyplot deals with
histograms, but I have not so far been able to find the right syntax.
 Note, the first code example works great, it is only the second (with the
hist attempt) that does not do well.  It creates 29 blank plots and 1
histogram instead of 30 histograms... so probably it does need a different
phrasing, but the one you suggest gives invalid syntax.

On Tue, Jun 26, 2012 at 9:19 PM, Don Jennings <dfjennings at gmail.com> wrote:

> > Message: 1
> > Date: Tue, 26 Jun 2012 18:40:50 +1000
> > From: Elaina Ann Hyde <elainahyde at gmail.com>
> > To: tutor at python.org
> > Subject: [Tutor] Looping over histogram plots
> <snip>
> >        set=(dat['a'+str(index)] == 1.00)
> You should not override the builtin set() type [1] as you've done here by
> assigning it.
> > #write the data
> >        P.hist(VGSR[set],bins=30, normed=True)
> I am not familiar with matplotlib, etc. but given that the primary
> difference in your two code samples is where you write the data, I suspect
> you want something like:
>        ax.plot(P.hist(VGSR[set],bins=30, normed=True))
> Take care,
> Don
> [1] http://docs.python.org/library/stdtypes.html#set

PhD Candidate
Department of Physics and Astronomy
Faculty of Science
Macquarie University
North Ryde, NSW 2109, Australia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120627/cf2f55f2/attachment-0001.html>

More information about the Tutor mailing list