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

/data1/GLAST/GLAST_EXT/python/2.5.1/lib/python2.5/site-packages/matplotlib/pyplot.pyc 
in imshow(*args, **kwargs)
   1673         hold(h)
   1674     try:
-> 1675         ret =  gca().imshow(*args, **kwargs)
   1676         draw_if_interactive()
   1677     except:

/data1/GLAST/GLAST_EXT/python/2.5.1/lib/python2.5/site-packages/matplotlib/axes.pyc 
in imshow(self, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, 
origin, extent, shape, filternorm, filterrad, imlim, **kwargs)
   4432                        filterrad=filterrad, **kwargs)
   4433
-> 4434         im.set_data(X)
   4435         im.set_alpha(alpha)
   4436         self._set_artist_props(im)

/data1/GLAST/GLAST_EXT/python/2.5.1/lib/python2.5/site-packages/matplotlib/image.pyc 
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
    236

/data1/GLAST/GLAST_EXT/python/2.5.1/lib/python2.5/site-packages/numpy/core/ma.pyc 
in asarray(data, dtype)
   2121         (dtype is None or dtype == data.dtype):
   2122         return data
-> 2123     return array(data, dtype=dtype, copy=0)
   2124
   2125 # Add methods to support ndarray interface

/data1/GLAST/GLAST_EXT/python/2.5.1/lib/python2.5/site-packages/numpy/core/ma.pyc 
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, 
order=order)
    568             tc = c.dtype
    569

ValueError: setting an array element with a sequence.


so something gets awry.
thanks in advance


More information about the SciPy-user mailing list