[Numpy-discussion] question about histogram2d
Darren Dale
darren.dale@cornell....
Thu May 29 20:34:34 CDT 2008
Hi David,
In that case, I suggest histogram2d could be improved with a brief comment in
the docstring to indicate how the output is formatted.
Cheers,
Darren
On Thursday 29 May 2008 8:21:58 pm David Huard wrote:
> Hi Darren,
>
> If I remember correctly, the thinking under the current behavior is that it
> preserves similarity of results with histogramdd, where the histogram is
> oriented in the numpy order (columns, rows). I thought that making
> histogram2d(x,y) return something different than histogramdd([x,y]) was
> probably worst than satisfying the cartesian convention.
>
> Regards,
>
> David
>
> 2008/5/29 Darren Dale <darren.dale@cornell.edu>:
> > I have a question about histogram2d. Say I do something like:
> >
> > import numpy
> > from numpy import random
> > import pylab
> >
> > x=random.rand(1000)-0.5
> > y=random.rand(1000)*10-5
> >
> > xbins=numpy.linspace(-10,10,100)
> > ybins=numpy.linspace(-10,10,100)
> > h,x,y=numpy.histogram2d(x,y,bins=[xbins,ybins])
> >
> > pylab.imshow(h,interpolation='nearest')
> > pylab.show()
> >
> > The output is attached. I think I would have expected the transpose of
> > what numpy histogram2d returned, so the tight x distribution appears
> > along the x axis in the image. Maybe I am thinking about this
> > incorrectly, or there is a
> > convention I am unfamiliar with. If the behavior is correct, could the
> > docstring include a comment explaining the orientation of the histogram
> > array?
> >
> > Thanks,
> > Darren
> >
> > --
> > Darren S. Dale, Ph.D.
> > Staff Scientist
> > Cornell High Energy Synchrotron Source
> > Cornell University
> > 275 Wilson Lab
> > Rt. 366 & Pine Tree Road
> > Ithaca, NY 14853
> >
> > darren.dale@cornell.edu
> > office: (607) 255-3819
> > fax: (607) 255-9001
> > http://www.chess.cornell.edu
> >
> > _______________________________________________
> > Numpy-discussion mailing list
> > Numpy-discussion@scipy.org
> > http://projects.scipy.org/mailman/listinfo/numpy-discussion
More information about the Numpy-discussion
mailing list