Hello all,

Today I was working on a top-level histogram plotting function by exposing 
matplotlib's hist as a Graphics object 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. 

I have also tried to use matplotlib 'patches' which outputted by the hist 
function and add them one by one to the the subplot in _render_on_subplot(), 
but the result was shifted in a funny way and I was worried that I may be 
losing some of the generality provided by using the subplot's hist method 
for the graphics generation.  

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. 

Thank you for your help. 

David Monarres

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to