On Thu, Jul 23, 2009 at 8:16 PM, D White<white.davi...@gmail.com> wrote:
>
> I'm having no luck getting the "bins" option to pylab.hist() to work.
> Here's an example:
>
> fish_data=[random() for i in range(100)]
> import pylab
> import numpy
>
> divats = numpy.arange(0.0,1.0,0.1)
> pylab.hist(fish_data, bins=divats)
> pylab.savefig('sage.png')
>
> Without the "bins=divats" it gives the expected output.  With it, it
> says "... TypeError: function not supported for these types, and can't
> coerce safely to supported types".  I was following the example at
> http://msenux.redwoods.edu/math/python/hist.php for the use of hist().
>
> Other approaches would be welcome.

I personally like drawing histograms using finance.TimeSeries, e.g.:

fish_data=[random() for i in range(100)]
v = finance.TimeSeries(fish_data)
v.plot_histogram(bins=10)

William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to