Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6e04afc

Browse files
committed
Simplify Legend.get_children.
_legend_box is inited to a non-None value in _init_legend_box which is called in `__init__`, so the `if self._legend_box` check is unnecessary.
1 parent 47cfa35 commit 6e04afc

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

lib/matplotlib/legend.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -885,13 +885,8 @@ def draw_frame(self, b):
885885
self.set_frame_on(b)
886886

887887
def get_children(self):
888-
"""Return the list of child artists."""
889-
children = []
890-
if self._legend_box:
891-
children.append(self._legend_box)
892-
children.append(self.get_frame())
893-
894-
return children
888+
# docstring inherited
889+
return [self._legend_box, self.get_frame()]
895890

896891
def get_frame(self):
897892
"""Return the `~.patches.Rectangle` used to frame the legend."""

0 commit comments

Comments
 (0)