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

Appearance settings

Commit 5e02f50

Browse filesBrowse files
committed
Merge pull request #1617 from jenshnielsen/legend_bbox
Legend: Also calc the bbox of the legend when the frame is not drawn. (1.2.x)
2 parents 293d42b + 6f07e0b commit 5e02f50
Copy full SHA for 5e02f50

File tree

Expand file treeCollapse file tree

1 file changed

+7
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-7
lines changed

‎lib/matplotlib/legend.py

Copy file name to clipboardExpand all lines: lib/matplotlib/legend.py
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -460,14 +460,14 @@ def draw(self, renderer):
460460
pad = 2 * (self.borderaxespad + self.borderpad) * fontsize
461461
self._legend_box.set_width(self.get_bbox_to_anchor().width - pad)
462462

463-
if self._drawFrame:
464-
# update the location and size of the legend
465-
bbox = self._legend_box.get_window_extent(renderer)
466-
self.legendPatch.set_bounds(bbox.x0, bbox.y0,
467-
bbox.width, bbox.height)
468-
469-
self.legendPatch.set_mutation_scale(fontsize)
463+
# update the location and size of the legend. This needs to
464+
# be done in any case to clip the figure right.
465+
bbox = self._legend_box.get_window_extent(renderer)
466+
self.legendPatch.set_bounds(bbox.x0, bbox.y0,
467+
bbox.width, bbox.height)
468+
self.legendPatch.set_mutation_scale(fontsize)
470469

470+
if self._drawFrame:
471471
if self.shadow:
472472
shadow = Shadow(self.legendPatch, 2, -2)
473473
shadow.draw(renderer)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.