11.. _howto-faq :
22
33******
4- How-To
4+ How-to
55******
66
77.. contents ::
1010
1111.. _howto-plotting :
1212
13- Plotting: howto
14- ===============
13+ How-to: Plotting
14+ ================
1515
1616.. _howto-datetime64 :
1717
@@ -37,6 +37,36 @@ If you only want to use the `pandas` converter for `datetime64` values ::
3737
3838
3939
40+ .. _howto-figure-empty :
41+
42+ Check whether a figure is empty
43+ -------------------------------
44+ Empty can actually mean different things. Does the figure contain any artists?
45+ Does a figure with an empty `~.axes.Axes ` still count as empty? Is the figure
46+ empty if it was rendered pure white (there may be artists present, but they
47+ could be outside the drawing area or transparent)?
48+
49+ For the purpose here, we define empty as: "The figure does not contain any
50+ artists except it's background patch." The exception for the background is
51+ necessary, because by default every figure contains a `.Rectangle ` as it's
52+ background patch. This definition could be checked via::
53+
54+ def is_empty(figure):
55+ """
56+ Return whether the figure contains no Artists (other than the default
57+ background patch).
58+ """
59+ contained_artists = figure.get_children()
60+ return len(contained_artists) <= 1
61+
62+ We've decided not to include this as a figure method because this is only one
63+ way of defining empty, and checking the above is only rarely necessary.
64+ Usually the user or program handling the figure know if they have added
65+ something to the figure.
66+
67+ Checking whether a figure would render empty cannot be reliably checked except
68+ by actually rendering the figure and investigating the rendered result.
69+
4070.. _howto-findobj :
4171
4272Find all objects in a figure of a certain type
@@ -552,8 +582,8 @@ GUI backends *require* being run from the main thread as well.
552582
553583.. _howto-contribute :
554584
555- Contributing: howto
556- ===================
585+ How-to: Contributing
586+ ====================
557587
558588.. _how-to-request-feature :
559589
@@ -640,8 +670,8 @@ or look at the open issues on github.
640670
641671.. _howto-webapp :
642672
643- Matplotlib in a web application server
644- ======================================
673+ How to use Matplotlib in a web application server
674+ =================================================
645675
646676In general, the simplest solution when using Matplotlib in a web server is
647677to completely avoid using pyplot (pyplot maintains references to the opened
@@ -693,8 +723,8 @@ contributing to these efforts that would be great.
693723
694724.. _how-to-search-examples :
695725
696- Search examples
697- ===============
726+ How to search for examples
727+ ==========================
698728
699729The nearly 300 code :ref: `examples-index ` included with the Matplotlib
700730source distribution are full-text searchable from the :ref: `search `
0 commit comments