From: Jae-Joon L. <lee...@gm...> - 2009-08-05 02:36:57
|
On Tue, Aug 4, 2009 at 12:14 PM, Christophe Dupre<chr...@vh...> wrote: > Hello, > > > > I've been playing with the animation_blit_gtk2 example > (http://matplotlib.sourceforge.net/examples/animation/animation_blit_gtk2.html > > ) and the latest version of matplotlib version 0.99.0-RC1. > > I've modified the example so that it displays candlesticks moving towards > the lelf. The example is attached if anybody is interested. > > > > > > In my example, I'm using 1 minute bars and therefore I would like to shift > the graph by 1 minute instead of a few pixels. Is there a way to convert a > time difference into pixels? > The "get_dx_data" method coverts a pixel offset to a data offset. So, what you need is just to invert it. This requires some knowledge of transformation, but I guess the code is rather self-explanatory. For example, something like below will work (sorry, I haven't actually tested the code) def get_dx_pixel(self, dx_data): tp = self.ax.transData.transform_point x0, y0 = tp((0, 0)) x1, y1 = tp((dx_data, 0)) return (x1-x0) Regards, -JJ > > > Thanks, > > > > Christophe > > > > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus > on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |