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

Commitf89a78c

Browse files
committed
Some more refactoring courtesy of@timhoffm
1 parent282ac53 commitf89a78c

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

‎lib/matplotlib/legend.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -484,13 +484,11 @@ def __init__(self, parent, handles, labels,
484484
raiseTypeError("Legend needs either Axes or Figure as parent")
485485
self.parent=parent
486486

487+
self._loc_used_default=locisNone
487488
iflocisNone:
488-
self._loc_used_default=True
489489
loc=rcParams["legend.loc"]
490490
ifnotself.isaxesandlocin [0,'best']:
491491
loc='upper right'
492-
else:
493-
self._loc_used_default=False
494492
ifisinstance(loc,str):
495493
iflocnotinself.codes:
496494
ifself.isaxes:
@@ -571,7 +569,9 @@ def __init__(self, parent, handles, labels,
571569
else:
572570
self.get_frame().set_alpha(framealpha)
573571

574-
self._set_loc(loc,is_initial_setting=True)
572+
tmp=self._loc_used_default
573+
self._set_loc(loc)
574+
self._loc_used_default=tmp# ignore changes done by _set_loc
575575

576576
# figure out title fontsize:
577577
iftitle_fontsizeisNone:
@@ -592,13 +592,11 @@ def _set_artist_props(self, a):
592592

593593
a.set_transform(self.get_transform())
594594

595-
def_set_loc(self,loc,is_initial_setting=False):
595+
def_set_loc(self,loc):
596596
# find_offset function will be provided to _legend_box and
597597
# _legend_box will draw itself at the location of the return
598598
# value of the find_offset.
599-
ifnotis_initial_setting:
600-
# User manually changed self._loc
601-
self._loc_used_default=False
599+
self._loc_used_default=False
602600
self._loc_real=loc
603601
self.stale=True
604602
self._legend_box.set_offset(self._findoffset)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp