I'm trying to make a bar-style histogram, along the lines of the last example figure from the extended histogram demo:

http://matplotlib.sourceforge.net/examples/pylab_examples/histogram_demo_extended.html

in which the several arrays to be histogrammed do not have the same length. However, I'm getting an error about "setting an array element with a sequence", even when I just cut-and-paste in the example code. The previous multi-histogram examples in which the array being plotted is generated using: x = mu + sigma*randn(1000,3) work fine though.

Am I doing something stupid?

Here's the trace:

In [25]: n, bins, patches = hist( [x0,x1,x2], 10, histtype='bar')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)

/Users/zane/svn/googlecode/<ipython console> in <module>()

/Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5-macosx-10.3- i386.egg/matplotlib/pyplot.pyc in hist(*args, **kwargs)
   1866         hold(h)
   1867     try:
-> 1868         ret =  gca().hist(*args, **kwargs)
   1869         draw_if_interactive()
   1870     except:

/Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5-macosx-10.3- i386.egg/matplotlib/axes.pyc in hist(self, x, bins, range, normed, cumulative, bottom, histtype, align, orientation, rwidth, log, **kwargs)
   6211
6212 # todo: make hist() work with list of arrays with different lengths
-> 6213         x = np.asarray(x).copy()
   6214         if len(x.shape)==2 and min(x.shape)==1:
   6215             x.shape = max(x.shape),

/Library/Python/2.5/site-packages/numpy-1.2.0.dev5677-py2.5- macosx-10.3-i386.egg/numpy/core/numeric.pyc in asarray(a, dtype, order)
    228
    229     """
--> 230     return array(a, dtype, copy=False, order=order)
    231
    232 def asanyarray(a, dtype=None, order=None):

ValueError: setting an array element with a sequence.


--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F








-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to