diff --git a/lib/matplotlib/legend.py b/lib/matplotlib/legend.py index 087cd90f13a7..68e22cda3709 100644 --- a/lib/matplotlib/legend.py +++ b/lib/matplotlib/legend.py @@ -460,14 +460,14 @@ def draw(self, renderer): pad = 2 * (self.borderaxespad + self.borderpad) * fontsize self._legend_box.set_width(self.get_bbox_to_anchor().width - pad) - if self._drawFrame: - # update the location and size of the legend - bbox = self._legend_box.get_window_extent(renderer) - self.legendPatch.set_bounds(bbox.x0, bbox.y0, - bbox.width, bbox.height) - - self.legendPatch.set_mutation_scale(fontsize) + # update the location and size of the legend. This needs to + # be done in any case to clip the figure right. + bbox = self._legend_box.get_window_extent(renderer) + self.legendPatch.set_bounds(bbox.x0, bbox.y0, + bbox.width, bbox.height) + self.legendPatch.set_mutation_scale(fontsize) + if self._drawFrame: if self.shadow: shadow = Shadow(self.legendPatch, 2, -2) shadow.draw(renderer)