Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit098b865

Browse files
kbroseImportanceOfBeingErnest
authored andcommitted
Document legend best slowness (#12203)
* Mention legend slowness in performance section* Mention legend slowness in legend docs
1 parent1437772 commit098b865

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

‎lib/matplotlib/legend.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ def _update_bbox_to_anchor(self, loc_in_canvas):
135135
corner of the legend in axes coordinates (in which case
136136
``bbox_to_anchor`` will be ignored).
137137
138+
The 'best' option can be quite slow for plots with large amounts
139+
of data. Your plotting speed may benefit from providing a specific
140+
location.
141+
138142
bbox_to_anchor : `.BboxBase`, 2-tuple, or 4-tuple of floats
139143
Box that is used to position the legend in conjunction with *loc*.
140144
Defaults to `axes.bbox` (if called as a method to `.Axes.legend`) or

‎tutorials/introductory/usage.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,14 @@ def my_plotter(ax, data1, data2, param_dict):
760760
# plt.plot(y)
761761
# plt.show()
762762
#
763+
# Legends
764+
# -------
765+
#
766+
# The default legend behavior for axes attempts to find the location
767+
# that covers the fewest data points (`loc='best'`). This can be a
768+
# very expensive computation if there are lots of data points. In
769+
# this case, you may want to provide a specific location.
770+
#
763771
# Using the *fast* style
764772
# ----------------------
765773
#

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp