On Mon, Jul 6, 2009 at 5:45 PM, Michael Cohen<mco...@caltech.edu> wrote:
> 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.


The weights kwarg is not yet in the official release, only in svn.  See

  http://matplotlib.sourceforge.net/faq/installing_faq.html#install-from-svn

The site docs and examples generally track svn, so sometimes you see
features that are not out yet.  We will try and get a release out
soon....

JDH

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to