From: Eric F. <ef...@ha...> - 2007-01-11 03:04:50
|
John Hunter wrote: >>>>>> "Christopher" == Christopher Barker <Chr...@no...> writes: > > Christopher> However, it is the case that there is a lot of stuff > Christopher> in pylab that makes it easier to use MPL in > Christopher> interactive mode. I kind of think that's a shame. I > Christopher> don't think that there is any reason that an OO > Christopher> interface is less suited to interactive mode. > > It's currently implemented in pylab but could be moved up to the OO > layer by doing something like > > class Axes: > def plot(self, *args, **kwargs): > ...plot something > if rcParams['interactive']: > self.figure.canvas.draw() I think this may be a slippery slope. The problem is that for it to work well, there has to be a clear distinction between methods that are endpoints, requiring a redraw, and methods that will be used by other methods. For example, errorbar makes multiple calls to plot, vline, etc. Even in interactive mode, we don't want redraws after each of those calls, only after the errorbar call itself. This could be handled by including an additional kwarg ("redraw=False"), or by requiring that methods like errorbar use only lower-level primitives, but either way, complexity increases. Eric > > or by providing some autowrapper facility to automate this. Probably > could be done elegantly with decorators, but we can't use decorators > yet... > > Or OO users can just call fig.canvas.draw() themselves when they want > to draw.... > > JDH > |