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 `numpy.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
@@ -553,8 +583,8 @@ most GUI backends *require* being run from the main thread as well.
553583
554584.. _howto-contribute :
555585
556- Contributing: howto
557- ===================
586+ How-to: Contributing
587+ ====================
558588
559589.. _how-to-request-feature :
560590
@@ -641,8 +671,8 @@ or look at the open issues on github.
641671
642672.. _howto-webapp :
643673
644- Matplotlib in a web application server
645- ======================================
674+ How to use Matplotlib in a web application server
675+ =================================================
646676
647677In general, the simplest solution when using Matplotlib in a web server is
648678to completely avoid using pyplot (pyplot maintains references to the opened
@@ -694,8 +724,8 @@ contributing to these efforts that would be great.
694724
695725.. _how-to-search-examples :
696726
697- Search examples
698- ===============
727+ How to search for examples
728+ ==========================
699729
700730The nearly 300 code :ref: `examples-index ` included with the Matplotlib
701731source distribution are full-text searchable from the :ref: `search `
0 commit comments