4
4
Legend guide
5
5
************
6
6
7
- Do not proceed unless you already have read :func: `~matplotlib.pyplot.legend ` and
8
- :class: `matplotlib.legend.Legend `!
7
+ Do not proceed unless you already have read :func: `~matplotlib.pyplot.legend `
8
+ and :class: `matplotlib.legend.Legend `!
9
9
10
10
11
11
What to be displayed
@@ -30,7 +30,7 @@ returns a tuple of two lists, i.e., list of artists and list of labels
30
30
(python string). However, it does not return all of its child
31
31
artists. It returns artists that are currently supported by matplotlib.
32
32
33
- For matplotlib v1.0 and before , the supported artists are as follows.
33
+ For matplotlib v1.0 and earlier , the supported artists are as follows.
34
34
35
35
* :class: `~matplotlib.lines.Line2D `
36
36
* :class: `~matplotlib.patches.Patch `
@@ -186,11 +186,12 @@ legend.
186
186
.. plot :: users/plotting/examples/simple_legend02.py
187
187
:include-source:
188
188
189
+ .. _legend-complex-plots :
189
190
190
191
Legend of Complex Plots
191
192
=======================
192
193
193
- In matplotlib v1.1 (FIXME when released) and later, the legend is
194
+ In matplotlib v1.1 and later, the legend is
194
195
improved to support more plot commands and ease the customization.
195
196
196
197
Artist Container
@@ -224,15 +225,15 @@ or ::
224
225
legend([b1], ["Bar 1"])
225
226
226
227
227
- At this time of writing, however, "bar" and "errorbar " are only
228
+ At this time of writing, however, only "bar", "errorbar", and "stem " are
228
229
supported (hopefully the list will increase). Here is an example.
229
230
230
231
.. plot :: mpl_examples/pylab_examples/legend_demo4.py
231
232
232
233
Legend Handler
233
234
--------------
234
235
235
- One of the change is that drawing of legend handles is delegated to
236
+ One of the changes is that drawing of legend handles has been delegated to
236
237
legend handlers. For example, :class: `~matplotlib.lines.Line2D `
237
238
instances are handled by
238
239
:class: `~matplotlib.legend_handler.HandlerLine2D `. The mapping
@@ -247,8 +248,9 @@ Let's consider the following sample code, ::
247
248
248
249
For each *p_i *, matplotlib
249
250
250
- 1. check if *p_i * itself is in the handler_map
251
- 2. if not, iterate over type(p_i).mro() until a matching key is found in the handler_map
251
+ 1. check if *p_i * is in the handler_map
252
+ 2. if not, iterate over type(p_i).mro() until a matching key is found
253
+ in the handler_map
252
254
253
255
254
256
Unless specified, the defaul handler_map is used. Below is a partial
@@ -260,7 +262,7 @@ list of key-handler pairs included in the default handler map.
260
262
* ...
261
263
262
264
263
- The legend command takes an optional argument of "handler_map". When
265
+ The legend() command takes an optional argument of "handler_map". When
264
266
provided, the default handler map will be updated (using dict.update
265
267
method) with the provided one. ::
266
268
@@ -279,9 +281,9 @@ instances (p1 and p2). ::
279
281
In the above example, only *p1 * will be handled by *my_handler *, while
280
282
others will be handled by default handlers.
281
283
282
- The curent default handler_map has handlers for errobar and bar
284
+ The curent default handler_map has handlers for errorbar and bar
283
285
plots. Also, it includes an entry for `tuple ` which is mapped to
284
- `HandlerTuple `. It simply overplots all the handles for items in the
286
+ `HandlerTuple `. It simply plots over all the handles for items in the
285
287
given tuple. For example,
286
288
287
289
@@ -312,5 +314,5 @@ pixles, and *handlebox* is a OffsetBox instance. Within the call, you
312
314
create relevant artists (using relevant properties from the *legend *
313
315
and/or *orig_handle *) and add them into the handlebox. The artists
314
316
needs to be scaled according to the fontsize (note that the size is in
315
- pixel, i.e., this is dpi-scaled value). See legend_handler.py for more
316
- details.
317
+ pixel, i.e., this is dpi-scaled value). See :mod: ` ~matplotlib.legend_handler `
318
+ for more details.
0 commit comments