Sorry, I didn't read carefully; you do seem to know about the timeseries code. I'm assuming that the xmax is the midpoint of the rightmost bin + half the bin width; are you doing something else? It's hard to guess at what's going wrong if you don't post code.
FWIW, I'd prefer that "plot_histogram" were a global, along the lines of def plot_histogram(x, *args, **kwargs): return TimeSeries(x).plot_histogram(*args,**kwargs) so I'm happy to see somebody working on this. On Wed, Jul 13, 2011 at 3:29 PM, David Monarres <dmmonar...@gmail.com> wrote: > 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 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 > -- 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