Re: [matplotlib-devel] Reorganizing axes plot methods
Eric Firing writes: > This would require pyplot to be imported by everything, wouldn't it? > That would completely defeat the strategy of having an OO level that > doesn't know about pyplot at all, and then having pyplot be the thin top > layer. Requiring pyplot isn't necessary, instead one may merely check if it's available. The following is what we do in a similar situation: try: fake_fig = matplotlib.pyplot.figure() except AttributeError: msg = 'matplotlib.pyplot is unavailable. Execute `import ' \ 'matplotlib.pyplot` or use a different output mode.' raise RuntimeError(msg) (obviously, one can substitute figure() call to gca()) Anton > > Eric > > > I haven't sat down and thought through all the details of such a change, > > but I wanted to throw it out there to see if anything sticks. > > > > Cheers, > > -Tony > > > > > > -- > > See everything from the browser to the database with AppDynamics > > Get end-to-end visibility with application monitoring from AppDynamics > > Isolate bottlenecks and diagnose root cause in seconds. > > Start your free trial of AppDynamics Pro today! > > http://pubads.g.doubleclick.net/gampad/clk? id=48808831&iu=/4140/ostg.clktrk > > > > > > > > ___ > > Matplotlib-devel mailing list > > Matplotlib-devel@... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > > > > -- > See everything from the browser to the database with AppDynamics > Get end-to-end visibility with application monitoring from AppDynamics > Isolate bottlenecks and diagnose root cause in seconds. > Start your free trial of AppDynamics Pro today! > http://pubads.g.doubleclick.net/gampad/clk? id=48808831&iu=/4140/ostg.clktrk > -- See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Reorganizing axes plot methods
On 2013/07/10 1:11 AM, Anton Akhmerov wrote: > Eric Firing writes: > >> This would require pyplot to be imported by everything, wouldn't it? >> That would completely defeat the strategy of having an OO level that >> doesn't know about pyplot at all, and then having pyplot be the thin top >> layer. > > Requiring pyplot isn't necessary, instead one may merely check if it's > available. The following is what we do in a similar situation: > >try: >fake_fig = matplotlib.pyplot.figure() >except AttributeError: >msg = 'matplotlib.pyplot is unavailable. Execute `import ' \ >'matplotlib.pyplot` or use a different output mode.' >raise RuntimeError(msg) > > (obviously, one can substitute figure() call to gca()) > > Anton Anton, Yes, I have done things like that in my own code, and basemap has a similar ability to call gca() when an Axes is not supplied. One can even perform the pyplot import on an as-needed basis instead of raising an error. Nevetheless, it still represents what I view as a big change in mpl design, scrambling the state machine pyplot layer into the OO layer. Sometimes this sort of thing is good, sometimes it isn't. In the present case, I am far from convinced that it would be good. I don't see any real benefit at all over the present design. I think that for the sanity of the developers, if nothing else, it is important to maintain some clear layering and hierarchy. Eric -- See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel