[SciPy-user] how to plot the result of histogram2d

Johann Cohen-Tanugi cohen@slac.stanford....
Fri Sep 5 10:36:53 CDT 2008

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))

ValueError                                Traceback (most recent call last)

/home/cohen/data1/WORK/GRB/data/GRB080904886/<ipython console> in <module>()

in imshow(*args, **kwargs)
   1673         hold(h)
   1674     try:
-> 1675         ret =  gca().imshow(*args, **kwargs)
   1676         draw_if_interactive()
   1677     except:

in imshow(self, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, 
origin, extent, shape, filternorm, filterrad, imlim, **kwargs)
   4432                        filterrad=filterrad, **kwargs)
-> 4434         im.set_data(X)
   4435         im.set_alpha(alpha)
   4436         self._set_artist_props(im)

in set_data(self, A, shape)
    232             X = pil_to_array(A)
    233         else:
--> 234             X = ma.asarray(A) # assume array
    235         self._A = X

in asarray(data, dtype)
   2121         (dtype is None or dtype == data.dtype):
   2122         return data
-> 2123     return array(data, dtype=dtype, copy=0)
   2125 # Add methods to support ndarray interface

in __init__(self, data, dtype, copy, order, mask, fill_value)
    565         else:
    566             need_data_copied = False #because I'll do it now
--> 567             c = numeric.array(data, dtype=tc, copy=True, 
    568             tc = c.dtype

ValueError: setting an array element with a sequence.

so something gets awry.
thanks in advance

More information about the SciPy-user mailing list