On 7/13/11 3:29 PM, David Monarres wrote:
Hello all,
Today I was working on a top-level histogram plotting function by
exposing matplotlib's hist as a Graphics object
Nice! Were you using http://trac.sagemath.org/sage_trac/ticket/9671 or
doing it yourself?
and I ran into something
that has stumped me. This is not surprising since I know very little
about matplotlib and am not all that experienced with programming in
general. I mainly wanted a nice simple histogram function that worked a
lot like the current plot and plot3D. I got a working prototype done in
a couple of hours but the code I had to resort to a bit of a kludge to
get a piece to work the way that I wanted. I basically am mirroring how
the scatter_plot.py works.
My problem is how to establish the axis information (in
self.get_minmax_data()) before I have computed the histogram. The 'xmin'
and 'xmax' are functions of the data but the frequencies are a function
of the bins computed by hist. I have solved this for now by running the
histogram code twice, once when initializing the class and once when
creating the matplotlib subplot. This seems like a waste. Does anybody
have an idea of how to work around this or another part of Sage where
this problem has been solved.
It looks like in trac ticket 9671 that I did the same thing that you did.
I will post the patches to Sage if anybody is interested in their
inclusion. Though I think that most people are happy working directly
with matplotlib or finance.timeseries to really be interested.
I have wanted matplotlib histograms to be wrapped in Sage for a long
time now. This fall I will be teaching a modeling course where I will
almost surely use such things. So thanks for working on this!
Thanks,
Jason
--
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
URL: http://www.sagemath.org