2
2
.. _howto-faq :
3
3
4
4
******
5
- How-To
5
+ How-to
6
6
******
7
7
8
8
.. contents ::
11
11
12
12
.. _howto-plotting :
13
13
14
- Plotting: howto
15
- ===============
14
+ How-to: Plotting
15
+ ================
16
16
17
17
.. _howto-datetime64 :
18
18
@@ -38,6 +38,36 @@ If you only want to use the `pandas` converter for `datetime64` values ::
38
38
39
39
40
40
41
+ .. _howto-figure-empty :
42
+
43
+ Check whether a figure is empty
44
+ -------------------------------
45
+ Empty can actually mean different things. Does the figure contain any artists?
46
+ Does a figure with an empty `~.axes.Axes ` still count as empty? Is the figure
47
+ empty if it was rendered pure white (there may be artists present, but they
48
+ could be outside the drawing area or transparent)?
49
+
50
+ For the purpose here, we define empty as: "The figure does not contain any
51
+ artists except it's background patch." The exception for the background is
52
+ necessary, because by default every figure contains a `.Rectangle ` as it's
53
+ background patch. This definition could be checked via::
54
+
55
+ def is_empty(figure):
56
+ """
57
+ Return whether the figure contains no Artists (other than the default
58
+ background patch).
59
+ """
60
+ contained_artists = figure.get_children()
61
+ return len(contained_artists) <= 1
62
+
63
+ We've decided not to include this as a figure method because this is only one
64
+ way of defining empty, and checking the above is only rarely necessary.
65
+ Usually the user or program handling the figure know if they have added
66
+ something to the figure.
67
+
68
+ Checking whether a figure would render empty cannot be reliably checked except
69
+ by actually rendering the figure and investigating the rendered result.
70
+
41
71
.. _howto-findobj :
42
72
43
73
Find all objects in a figure of a certain type
@@ -549,8 +579,8 @@ GUI backends *require* being run from the main thread as well.
549
579
550
580
.. _howto-contribute :
551
581
552
- Contributing: howto
553
- ===================
582
+ How-to: Contributing
583
+ ====================
554
584
555
585
.. _how-to-request-feature :
556
586
@@ -637,8 +667,8 @@ or look at the open issues on github.
637
667
638
668
.. _howto-webapp :
639
669
640
- Matplotlib in a web application server
641
- ======================================
670
+ How to use Matplotlib in a web application server
671
+ =================================================
642
672
643
673
In general, the simplest solution when using Matplotlib in a web server is
644
674
to completely avoid using pyplot (pyplot maintains references to the opened
@@ -690,8 +720,8 @@ contributing to these efforts that would be great.
690
720
691
721
.. _how-to-search-examples :
692
722
693
- Search examples
694
- ===============
723
+ How to search for examples
724
+ ==========================
695
725
696
726
The nearly 300 code :ref: `examples-index ` included with the Matplotlib
697
727
source distribution are full-text searchable from the :ref: `search `
0 commit comments