Skip to content

Commit da1763c

Browse files
committed
DOC: make legend docstring interpolated
1 parent b1f5c43 commit da1763c

File tree

4 files changed

+4
-533
lines changed

4 files changed

+4
-533
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 166 deletions
Original file line numberDiff line numberDiff line change
@@ -363,172 +363,7 @@ def legend(self, *args, **kwargs):
363363
Other Parameters
364364
----------------
365365
366-
loc : int or string or pair of floats, default: 'upper right'
367-
The location of the legend. Possible codes are:
368-
369-
=============== =============
370-
Location String Location Code
371-
=============== =============
372-
'best' 0
373-
'upper right' 1
374-
'upper left' 2
375-
'lower left' 3
376-
'lower right' 4
377-
'right' 5
378-
'center left' 6
379-
'center right' 7
380-
'lower center' 8
381-
'upper center' 9
382-
'center' 10
383-
=============== =============
384-
385-
386-
Alternatively can be a 2-tuple giving ``x, y`` of the lower-left
387-
corner of the legend in axes coordinates (in which case
388-
``bbox_to_anchor`` will be ignored).
389-
390-
bbox_to_anchor : `.BboxBase` or pair of floats
391-
Specify any arbitrary location for the legend in `bbox_transform`
392-
coordinates (default Axes coordinates).
393-
394-
For example, to put the legend's upper right hand corner in the
395-
center of the axes the following keywords can be used::
396-
397-
loc='upper right', bbox_to_anchor=(0.5, 0.5)
398-
399-
ncol : integer
400-
The number of columns that the legend has. Default is 1.
401-
402-
prop : None or :class:`matplotlib.font_manager.FontProperties` or dict
403-
The font properties of the legend. If None (default), the current
404-
:data:`matplotlib.rcParams` will be used.
405-
406-
fontsize : int or float or {'xx-small', 'x-small', 'small', 'medium', \
407-
'large', 'x-large', 'xx-large'}
408-
Controls the font size of the legend. If the value is numeric the
409-
size will be the absolute font size in points. String values are
410-
relative to the current default font size. This argument is only
411-
used if `prop` is not specified.
412-
413-
numpoints : None or int
414-
The number of marker points in the legend when creating a legend
415-
entry for a `.Line2D` (line).
416-
Default is ``None``, which will take the value from
417-
:rc:`legend.numpoints`.
418-
419-
scatterpoints : None or int
420-
The number of marker points in the legend when creating
421-
a legend entry for a `.PathCollection` (scatter plot).
422-
Default is ``None``, which will take the value from
423-
:rc:`legend.scatterpoints`.
424-
425-
scatteryoffsets : iterable of floats
426-
The vertical offset (relative to the font size) for the markers
427-
created for a scatter plot legend entry. 0.0 is at the base the
428-
legend text, and 1.0 is at the top. To draw all markers at the
429-
same height, set to ``[0.5]``. Default is ``[0.375, 0.5, 0.3125]``.
430-
431-
markerscale : None or int or float
432-
The relative size of legend markers compared with the originally
433-
drawn ones.
434-
Default is ``None``, which will take the value from
435-
:rc:`legend.markerscale`.
436-
437-
markerfirst : bool
438-
If *True*, legend marker is placed to the left of the legend label.
439-
If *False*, legend marker is placed to the right of the legend
440-
label.
441-
Default is *True*.
442-
443-
frameon : None or bool
444-
Control whether the legend should be drawn on a patch
445-
(frame).
446-
Default is ``None``, which will take the value from
447-
:rc:`legend.frameon`.
448-
449-
fancybox : None or bool
450-
Control whether round edges should be enabled around the
451-
:class:`~matplotlib.patches.FancyBboxPatch` which makes up the
452-
legend's background.
453-
Default is ``None``, which will take the value from
454-
:rc:`legend.fancybox`.
455-
456-
shadow : None or bool
457-
Control whether to draw a shadow behind the legend.
458-
Default is ``None``, which will take the value from
459-
:rc:`legend.shadow`.
460-
461-
framealpha : None or float
462-
Control the alpha transparency of the legend's background.
463-
Default is ``None``, which will take the value from
464-
:rc:`legend.framealpha`. If shadow is activated and
465-
*framealpha* is ``None``, the default value is ignored.
466-
467-
facecolor : None or "inherit" or a color spec
468-
Control the legend's background color.
469-
Default is ``None``, which will take the value from
470-
:rc:`legend.facecolor`. If ``"inherit"``, it will take
471-
:rc:`axes.facecolor`.
472-
473-
edgecolor : None or "inherit" or a color spec
474-
Control the legend's background patch edge color.
475-
Default is ``None``, which will take the value from
476-
:rc:`legend.edgecolor` If ``"inherit"``, it will take
477-
:rc:`axes.edgecolor`.
478-
479-
mode : {"expand", None}
480-
If `mode` is set to ``"expand"`` the legend will be horizontally
481-
expanded to fill the axes area (or `bbox_to_anchor` if defines
482-
the legend's size).
483-
484-
bbox_transform : None or :class:`matplotlib.transforms.Transform`
485-
The transform for the bounding box (`bbox_to_anchor`). For a value
486-
of ``None`` (default) the Axes'
487-
:data:`~matplotlib.axes.Axes.transAxes` transform will be used.
488-
489-
title : str or None
490-
The legend's title. Default is no title (``None``).
491-
492-
borderpad : float or None
493-
The fractional whitespace inside the legend border.
494-
Measured in font-size units.
495-
Default is ``None``, which will take the value from
496-
:rc:`legend.borderpad`.
497-
498-
labelspacing : float or None
499-
The vertical space between the legend entries.
500-
Measured in font-size units.
501-
Default is ``None``, which will take the value from
502-
:rc:`legend.labelspacing`.
503-
504-
handlelength : float or None
505-
The length of the legend handles.
506-
Measured in font-size units.
507-
Default is ``None``, which will take the value from
508-
:rc:`legend.handlelength`.
509-
510-
handletextpad : float or None
511-
The pad between the legend handle and text.
512-
Measured in font-size units.
513-
Default is ``None``, which will take the value from
514-
:rc:`legend.handletextpad`.
515-
516-
borderaxespad : float or None
517-
The pad between the axes and legend border.
518-
Measured in font-size units.
519-
Default is ``None``, which will take the value from
520-
:rc:`legend.borderaxespad`.
521-
522-
columnspacing : float or None
523-
The spacing between columns.
524-
Measured in font-size units.
525-
Default is ``None``, which will take the value from
526-
:rc:`legend.columnspacing`.
527-
528-
handler_map : dict or None
529-
The custom dictionary mapping instances or types to a legend
530-
handler. This `handler_map` updates the default handler map
531-
found at :func:`matplotlib.legend.Legend.get_legend_handler_map`.
366+
%(_legend_kw_doc)s
532367
533368
Returns
534369
-------

lib/matplotlib/figure.py

Lines changed: 1 addition & 166 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,172 +1574,7 @@ def legend(self, *args, **kwargs):
15741574
Other Parameters
15751575
----------------
15761576
1577-
loc : int or string or pair of floats, default: 'upper right'
1578-
The location of the legend. Possible codes are:
1579-
1580-
=============== =============
1581-
Location String Location Code
1582-
=============== =============
1583-
'best' 0
1584-
'upper right' 1
1585-
'upper left' 2
1586-
'lower left' 3
1587-
'lower right' 4
1588-
'right' 5
1589-
'center left' 6
1590-
'center right' 7
1591-
'lower center' 8
1592-
'upper center' 9
1593-
'center' 10
1594-
=============== =============
1595-
1596-
1597-
Alternatively can be a 2-tuple giving ``x, y`` of the lower-left
1598-
corner of the legend in axes coordinates (in which case
1599-
``bbox_to_anchor`` will be ignored).
1600-
1601-
bbox_to_anchor : `.BboxBase` or pair of floats
1602-
Specify any arbitrary location for the legend in `bbox_transform`
1603-
coordinates (default Axes coordinates).
1604-
1605-
For example, to put the legend's upper right hand corner in the
1606-
center of the axes the following keywords can be used::
1607-
1608-
loc='upper right', bbox_to_anchor=(0.5, 0.5)
1609-
1610-
ncol : integer
1611-
The number of columns that the legend has. Default is 1.
1612-
1613-
prop : None or :class:`matplotlib.font_manager.FontProperties` or dict
1614-
The font properties of the legend. If None (default), the current
1615-
:data:`matplotlib.rcParams` will be used.
1616-
1617-
fontsize : int or float or {'xx-small', 'x-small', 'small', 'medium', \
1618-
'large', 'x-large', 'xx-large'}
1619-
Controls the font size of the legend. If the value is numeric the
1620-
size will be the absolute font size in points. String values are
1621-
relative to the current default font size. This argument is only
1622-
used if `prop` is not specified.
1623-
1624-
numpoints : None or int
1625-
The number of marker points in the legend when creating a legend
1626-
entry for a `.Line2D` (line).
1627-
Default is ``None``, which will take the value from
1628-
:rc:`legend.numpoints`.
1629-
1630-
scatterpoints : None or int
1631-
The number of marker points in the legend when creating
1632-
a legend entry for a `.PathCollection` (scatter plot).
1633-
Default is ``None``, which will take the value from
1634-
:rc:`legend.scatterpoints`.
1635-
1636-
scatteryoffsets : iterable of floats
1637-
The vertical offset (relative to the font size) for the markers
1638-
created for a scatter plot legend entry. 0.0 is at the base the
1639-
legend text, and 1.0 is at the top. To draw all markers at the
1640-
same height, set to ``[0.5]``. Default is ``[0.375, 0.5, 0.3125]``.
1641-
1642-
markerscale : None or int or float
1643-
The relative size of legend markers compared with the originally
1644-
drawn ones.
1645-
Default is ``None``, which will take the value from
1646-
:rc:`legend.markerscale`.
1647-
1648-
markerfirst : bool
1649-
If *True*, legend marker is placed to the left of the legend label.
1650-
If *False*, legend marker is placed to the right of the legend
1651-
label.
1652-
Default is *True*.
1653-
1654-
frameon : None or bool
1655-
Control whether the legend should be drawn on a patch
1656-
(frame).
1657-
Default is ``None``, which will take the value from
1658-
:rc:`legend.frameon`.
1659-
1660-
fancybox : None or bool
1661-
Control whether round edges should be enabled around the
1662-
:class:`~matplotlib.patches.FancyBboxPatch` which makes up the
1663-
legend's background.
1664-
Default is ``None``, which will take the value from
1665-
:rc:`legend.fancybox`.
1666-
1667-
shadow : None or bool
1668-
Control whether to draw a shadow behind the legend.
1669-
Default is ``None``, which will take the value from
1670-
:rc:`legend.shadow`.
1671-
1672-
framealpha : None or float
1673-
Control the alpha transparency of the legend's background.
1674-
Default is ``None``, which will take the value from
1675-
:rc:`legend.framealpha`. If shadow is activated and
1676-
*framealpha* is ``None``, the default value is ignored.
1677-
1678-
facecolor : None or "inherit" or a color spec
1679-
Control the legend's background color.
1680-
Default is ``None``, which will take the value from
1681-
:rc:`legend.facecolor`. If ``"inherit"``, it will take
1682-
:rc:`axes.facecolor`.
1683-
1684-
edgecolor : None or "inherit" or a color spec
1685-
Control the legend's background patch edge color.
1686-
Default is ``None``, which will take the value from
1687-
:rc:`legend.edgecolor` If ``"inherit"``, it will take
1688-
:rc:`axes.edgecolor`.
1689-
1690-
mode : {"expand", None}
1691-
If `mode` is set to ``"expand"`` the legend will be horizontally
1692-
expanded to fill the axes area (or `bbox_to_anchor` if defines
1693-
the legend's size).
1694-
1695-
bbox_transform : None or :class:`matplotlib.transforms.Transform`
1696-
The transform for the bounding box (`bbox_to_anchor`). For a value
1697-
of ``None`` (default) the Axes'
1698-
:data:`~matplotlib.axes.Axes.transAxes` transform will be used.
1699-
1700-
title : str or None
1701-
The legend's title. Default is no title (``None``).
1702-
1703-
borderpad : float or None
1704-
The fractional whitespace inside the legend border.
1705-
Measured in font-size units.
1706-
Default is ``None``, which will take the value from
1707-
:rc:`legend.borderpad`.
1708-
1709-
labelspacing : float or None
1710-
The vertical space between the legend entries.
1711-
Measured in font-size units.
1712-
Default is ``None``, which will take the value from
1713-
:rc:`legend.labelspacing`.
1714-
1715-
handlelength : float or None
1716-
The length of the legend handles.
1717-
Measured in font-size units.
1718-
Default is ``None``, which will take the value from
1719-
:rc:`legend.handlelength`.
1720-
1721-
handletextpad : float or None
1722-
The pad between the legend handle and text.
1723-
Measured in font-size units.
1724-
Default is ``None``, which will take the value from
1725-
:rc:`legend.handletextpad`.
1726-
1727-
borderaxespad : float or None
1728-
The pad between the axes and legend border.
1729-
Measured in font-size units.
1730-
Default is ``None``, which will take the value from
1731-
:rc:`legend.borderaxespad`.
1732-
1733-
columnspacing : float or None
1734-
The spacing between columns.
1735-
Measured in font-size units.
1736-
Default is ``None``, which will take the value from
1737-
:rc:`legend.columnspacing`.
1738-
1739-
handler_map : dict or None
1740-
The custom dictionary mapping instances or types to a legend
1741-
handler. This `handler_map` updates the default handler map
1742-
found at :func:`matplotlib.legend.Legend.get_legend_handler_map`.
1577+
%(_legend_kw_doc)s
17431578
17441579
Returns
17451580
-------

0 commit comments

Comments
 (0)