2012/11/14 Skipper Seabold <jsseab...@gmail.com>: > Hi All, > > Hoping someone can help me get a definitive answer to this question. > Is draw_if_interactive bad to have in library plotting code?
I think the only issue here is the overhead of importing the whole pyplot stuff and checking every now and then for interactive mode in code which is not mainly designed for interactive use. Something that I often do is writing non interactive plotting functions or methods and then wrappers for interactive use which call draw_if_interactive ant do other fancy things. Goyo > > Based on this thread [1], we've been working under the assumption that > calling draw_if_interactive in plotting code is bad. Though I'm > skeptical that this is the takeaway that we should have. I also asked > this question on the IPython mailing list [2] since the recommendation > comes from their type of usage, but I'm still not clear. > > I'll repeat the gist of the question here. > > We have plotting functions that are designed to update a given axes. I > often work in interactive mode, and I'd like it if these functions > updated my axes in the way that I expect (and an R user doing plotting > in Python would expect). But now I'm forced to litter my user scripts > with draw_if_interactive after I call a function I expect to update a > plot - say updating a scatter plot with a regression line. Would be > harmful to just include these draw_if_interactive calls in our plot > functions. To be clear, I never have to call show or draw because I'm > working in interactive mode, so the recommendation to just call show() > at the end of a script is not what I want. > > My understanding of the pitfalls is 1) there's a performance hit to > calling draw instead of just making one call. This is moot because > we're only calling draw_if_interactive - so we assume the user is > working interactively and actually wants to do the drawing and doesn't > care about the performance hit. And 2) we are assuming that the user > has imported and is using pyplot and there are possible side effects. > A user wouldn't be using pyplot in a GUI or in some sort of embedded > plotting framework. However, my intuition says that if this is the > case, draw_if_interactive won't do anything because interactive will > be False in these cases. > > Can someone please help clear this up? Thanks, > > Skipper > > > [1] > https://groups.google.com/forum/#!msg/pystatsmodels/biNlCvJPNNY/BT7bQJmOa1cJ > [2] > http://python.6.n6.nabble.com/IPython-User-using-matplotlib-draw-if-interactive-in-library-code-td4991275.html > > ------------------------------------------------------------------------------ > Monitor your physical, virtual and cloud infrastructure from a single > web console. Get in-depth insight into apps, servers, databases, vmware, > SAP, cloud infrastructure, etc. Download 30-day Free Trial. > Pricing starts from $795 for 25 servers or applications! > http://p.sf.net/sfu/zoho_dev2dev_nov > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users ------------------------------------------------------------------------------ Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users