John Hunter wrote: > On Thu, Apr 9, 2009 at 4:02 PM, mm2ps <d...@armadaletechnologies.co.uk> wrote: >> Hi, >> >> How would you check that there is something to show() before you show()? > > Although it is a bit inelegant, you could use the _pylab_helpers > module to see how many figure managers are active
In svn trunk this is exposed in pyplot.py: len(pyplot.get_fignums()) should do it. Eric > > > home:~> ipython -pylab > Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) > Type "copyright", "credits" or "license" for more information. > > IPython 0.9.1 -- An enhanced Interactive Python. > ? -> Introduction and overview of IPython's features. > %quickref -> Quick reference. > help -> Python's own help system. > object? -> Details about 'object'. ?object also works, ?? prints more. > > Welcome to pylab, a matplotlib-based Python environment. > For more information, type 'help(pylab)'. > > In [1]: plot([1,2,3]) > Out[1]: [<matplotlib.lines.Line2D object at 0x46bfd70>] > > In [2]: import matplotlib._pylab_helpers as _pylab_helpers > > In [3]: print _pylab_helpers.Gcf.get_num_fig_managers() > 1 > > JDH > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > High Quality Requirements in a Collaborative Environment. > Download a free trial of Rational Requirements Composer Now! > http://p.sf.net/sfu/www-ibm-com > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users ------------------------------------------------------------------------------ This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users