Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Legend: Also calc the bbox of the legend when the frame is not drawn. (1.2.x) #1617

Merged
merged 1 commit into from

3 participants

@jenshnielsen

This should fix #1586

@jenshnielsen

One could also add a test however this must be against master since the bbox_tight tests are only there.

@jenshnielsen

The Travis failure is not relevant. It fails to install nose on Python3.1

@dmcdougall
Collaborator

Why must the test only be added to the master branch? Worst case scenario is you add a test in v1.2.x and one of the developers merging v1.2.x into master sees a merge conflict. Am I missing something?

@jenshnielsen

The existing test for bbox_tigth are only on the master branch and this test would most naturally be done on top of
this one. The tests need to option to pass bbox_inches to the savefig command which was added to master only
in 45fa53d ect. from #1420

@mdboom
Owner

I see. I'll merge this and then merge it to master, and fix any tests if necessary.

@mdboom mdboom merged commit 5e02f50 into matplotlib:v1.2.x
@jenshnielsen jenshnielsen deleted the jenshnielsen:legend_bbox branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 20, 2012
  1. @jenshnielsen
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 7 deletions.
  1. +7 −7 lib/matplotlib/legend.py
View
14 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)
Something went wrong with that request. Please try again.