pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/matplotlib/matplotlib/commit/7820a63f84cdc6c5e434665a62065e2d3d21ebd1

gin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-9c8f61f9f58ad7b2.css" /> Improve legend loc and bbox_to_anchor documentation (#26620) (#31422) · matplotlib/matplotlib@7820a63 · GitHub
Skip to content

Commit 7820a63

Browse files
Improve legend loc and bbox_to_anchor documentation (#26620) (#31422)
* Improve legend loc and bbox_to_anchor documentation (#26620) * Update lib/matplotlib/legend.py Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> * Update lib/matplotlib/legend.py Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> --------- Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
1 parent 809ad23 commit 7820a63

1 file changed

Lines changed: 18 additions & 9 deletions

File tree

lib/matplotlib/legend.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,11 @@ def _update_bbox_to_anchor(self, loc_in_canvas):
9898
_legend_kw_doc_base = """
9999
bbox_to_anchor : `.BboxBase`, 2-tuple, or 4-tuple of floats
100100
Box that is used to position the legend in conjunction with *loc*.
101+
This is an advanced option for free placement of the legend. For
102+
most use cases, *loc* alone is sufficient.
103+
101104
Defaults to ``axes.bbox`` (if called as a method to `.Axes.legend`) or
102-
``figure.bbox`` (if ``figure.legend``). This argument allows arbitrary
103-
placement of the legend.
105+
``figure.bbox`` (if ``figure.legend``).
104106
105107
Bbox coordinates are interpreted in the coordinate system given by
106108
*bbox_transform*, with the default transform
@@ -119,6 +121,9 @@ def _update_bbox_to_anchor(self, loc_in_canvas):
119121
120122
loc='upper right', bbox_to_anchor=(0.5, 0.5)
121123
124+
For more details on legend positioning, see the
125+
:ref:`legend_guide`.
126+
122127
ncols : int, default: 1
123128
The number of columns that the legend has.
124129
@@ -265,15 +270,19 @@ def _update_bbox_to_anchor(self, loc_in_canvas):
265270
loc : str or pair of floats, default: {default}
266271
The location of the legend.
267272
268-
The strings ``'upper left'``, ``'upper right'``, ``'lower left'``,
269-
``'lower right'`` place the legend at the corresponding corner of the
270-
{parent}.
273+
The string locations place the legend at the corresponding position
274+
within the bounding box, which by default is the full {parent} area.
275+
The bounding box can be changed via *bbox_to_anchor*.
271276
272-
The strings ``'upper center'``, ``'lower center'``, ``'center left'``,
273-
``'center right'`` place the legend at the center of the corresponding edge
274-
of the {parent}.
277+
The positions are visualized below::
275278
276-
The string ``'center'`` places the legend at the center of the {parent}.
279+
+--------------+--------------+---------------+
280+
| 'upper left' |'upper center'| 'upper right' |
281+
+--------------+--------------+---------------+
282+
|'center left' | 'center' |'center right' |
283+
+--------------+--------------+---------------+
284+
| 'lower left' |'lower center'| 'lower right' |
285+
+--------------+--------------+---------------+
277286
{best}
278287
The location can also be a 2-tuple giving the coordinates of the lower-left
279288
corner of the legend in {parent} coordinates (in which case *bbox_to_anchor*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy