-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FIX: use cached renderer on Legend.get_window_extent #11971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -976,9 +976,11 @@ def get_title(self): | |
'Return the `.Text` instance for the legend title.' | ||
return self._legend_title_box._text | ||
|
||
def get_window_extent(self, *args, **kwargs): | ||
def get_window_extent(self, renderer=None): | ||
'Return extent of the legend.' | ||
return self._legend_box.get_window_extent(*args, **kwargs) | ||
if renderer is None: | ||
renderer = self.figure._cachedRenderer | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, we have lots of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we want to always fall back to the cached renderer. There are some use-cases (such as the mixed-mode vector/raster cases where we need to be able to specify which renderer we want to be using with out having to propgate that state globally. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the mixed mode renderer is the only case where this could be a problem, right? |
||
return self._legend_box.get_window_extent(renderer=renderer) | ||
|
||
def get_tightbbox(self, renderer): | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's technically a backward incompatible change (although, as I've mentioned in a previous PR doing something similar, I think this is a change that is worth making.)