1
1
.. _howto-faq :
2
2
3
3
******
4
- How-To
4
+ How-to
5
5
******
6
6
7
7
.. contents ::
10
10
11
11
.. _howto-plotting :
12
12
13
- Plotting: howto
14
- ===============
13
+ How-to: Plotting
14
+ ================
15
15
16
16
.. _howto-datetime64 :
17
17
@@ -37,6 +37,36 @@ If you only want to use the `pandas` converter for `numpy.datetime64` values ::
37
37
38
38
39
39
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
+
40
70
.. _howto-findobj :
41
71
42
72
Find 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.
553
583
554
584
.. _howto-contribute :
555
585
556
- Contributing: howto
557
- ===================
586
+ How-to: Contributing
587
+ ====================
558
588
559
589
.. _how-to-request-feature :
560
590
@@ -641,8 +671,8 @@ or look at the open issues on github.
641
671
642
672
.. _howto-webapp :
643
673
644
- Matplotlib in a web application server
645
- ======================================
674
+ How to use Matplotlib in a web application server
675
+ =================================================
646
676
647
677
In general, the simplest solution when using Matplotlib in a web server is
648
678
to completely avoid using pyplot (pyplot maintains references to the opened
@@ -694,8 +724,8 @@ contributing to these efforts that would be great.
694
724
695
725
.. _how-to-search-examples :
696
726
697
- Search examples
698
- ===============
727
+ How to search for examples
728
+ ==========================
699
729
700
730
The nearly 300 code :ref: `examples-index ` included with the Matplotlib
701
731
source distribution are full-text searchable from the :ref: `search `
0 commit comments