[Numpy-discussion] question about histogram2d

Darren Dale darren.dale@cornell....
Thu May 29 12:54:23 CDT 2008


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hist2dimage.png
Type: image/png
Size: 4305 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080529/09368530/attachment.png 


More information about the Numpy-discussion mailing list