Skip to content

Commit

Permalink
Merge pull request #1617 from jenshnielsen/legend_bbox
Browse files Browse the repository at this point in the history
Legend: Also calc the bbox of the legend when the frame is not drawn. (1.2.x)
  • Loading branch information
mdboom committed Jan 16, 2013
2 parents 293d42b + 6f07e0b commit 5e02f50
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/matplotlib/legend.py
Expand Up @@ -460,14 +460,14 @@ def draw(self, renderer):
pad = 2 * (self.borderaxespad + self.borderpad) * fontsize pad = 2 * (self.borderaxespad + self.borderpad) * fontsize
self._legend_box.set_width(self.get_bbox_to_anchor().width - pad) self._legend_box.set_width(self.get_bbox_to_anchor().width - pad)


if self._drawFrame: # update the location and size of the legend. This needs to
# update the location and size of the legend # be done in any case to clip the figure right.
bbox = self._legend_box.get_window_extent(renderer) bbox = self._legend_box.get_window_extent(renderer)
self.legendPatch.set_bounds(bbox.x0, bbox.y0, self.legendPatch.set_bounds(bbox.x0, bbox.y0,
bbox.width, bbox.height) bbox.width, bbox.height)

self.legendPatch.set_mutation_scale(fontsize)
self.legendPatch.set_mutation_scale(fontsize)


if self._drawFrame:
if self.shadow: if self.shadow:
shadow = Shadow(self.legendPatch, 2, -2) shadow = Shadow(self.legendPatch, 2, -2)
shadow.draw(renderer) shadow.draw(renderer)
Expand Down

0 comments on commit 5e02f50

Please sign in to comment.