Hi all,
I am trying to produce a weighted histogram.
The help text for "hist" here:
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.hist
has a mention of adding weights, but it is not noted in the command line 
section where this should appear.

Calling:
hist(data,20,data_weights)

gives the error:
   File 
"/usr/local/python-2.5.2/lib/python2.5/site-packages/matplotlib/pyplot.py", 
line 1868, in hist
     ret =  gca().hist(*args, **kwargs)
   File 
"/usr/local/python-2.5.2/lib/python2.5/site-packages/matplotlib/axes.py", 
line 6236, in hist
     normed=bool(normed), new=True)
   File 
"/usr/local/python-2.5.2/lib/python2.5/site-packages/numpy/lib/function_base.py",
 
line 353, in histogram
     mn, mx = range
ValueError: too many values to unpack

Calling:
hist(data,20,weights=data_weights)

gives the error:
   File 
"/usr/local/python-2.5.2/lib/python2.5/site-packages/matplotlib/pyplot.py", 
line 1868, in hist
     ret =  gca().hist(*args, **kwargs)
   File 
"/usr/local/python-2.5.2/lib/python2.5/site-packages/matplotlib/axes.py", 
line 6371, in hist
     p.update(kwargs)
   File 
"/usr/local/python-2.5.2/lib/python2.5/site-packages/matplotlib/artist.py", 
line 453, in update
     raise AttributeError('Unknown property %s'%k)
AttributeError: Unknown property weights

There's no indication in the help text of where or how to insert the 
weights array.

Thanks in advance,
Michael

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to