thanks Johan,

I posted to scipy because of histogram2d being in numpy, sorry about that.

Now the stupid question, why can't imshow directly parse histogram2d, without the transitory extent object?

Anyway, I am happy that there is a simple way as explained below!

thanks again,

Johann

John Hunter wrote:

## ···

On Fri, Sep 5, 2008 at 10:36 AM, Johann Cohen-Tanugi > <cohen@...1565...> wrote:

hi, I hope someone can quickly point me to some doc.

I can do imshow(histogram2d(x,y)[0]) but then I miss the x and y binning

correct labels.

If I do imshow(histogram2d(x,y)) I get:

ERROR: An unexpected error occurred while tokenizing input

The following traceback may be corrupted or invalid

The error message is: ('EOF in multi-line statement', (115, 0))

matplotlib questions are best addressed to the matplotlib-users mailing list athttp://lists.sourceforge.net/mailman/listinfo/matplotlib-users

histogram2d returns H, xedges and yedges. The first argument should

be passed to imshow, and the second two can be used to get the extentsIn [26]: x, y = np.random.randn(2, 100000)

In [27]: H, xedges, yedges = np.histogram2d(x, y, bins=50)

In [28]: extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]]

In [29]: imshow(H, extent=extent)

Out[29]: <matplotlib.image.AxesImage object at 0x9377bcc>I

_______________________________________________

SciPy-user mailing list

SciPy-user@...177...

http://projects.scipy.org/mailman/listinfo/scipy-user