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

tight_layout: fix regression for figures with non SubplotBase Axes #1163

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

Merged
merged 1 commit into from
Aug 29, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions 11 lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1424,16 +1424,15 @@ def tight_layout(self, renderer=None, pad=1.08, h_pad=None, w_pad=None, rect=Non

from tight_layout import get_renderer, get_tight_layout_figure

no_go = [ax for ax in self.axes if not isinstance(ax, SubplotBase)]
if no_go:
warnings.Warn("Cannot use tight_layout;"
" all Axes must descend from SubplotBase")
return
subplot_axes = [ax for ax in self.axes if isinstance(ax, SubplotBase)]
if len(subplot_axes) < len(self.axes):
warnings.warn("tight_layout can only process Axes that descend "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the word "descend" here is a bit confusing. I think the more commonly used term in OO is "inherit". If there's no objections, since this is already merged, I'll just go ahead and fix this directly on master.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On 2012/08/29 3:48 AM, Michael Droettboom wrote:

In lib/matplotlib/figure.py:

@@ -1424,16 +1424,15 @@ def tight_layout(self, renderer=None, pad=1.08, h_pad=None, w_pad=None, rect=Non

     from tight_layout import get_renderer, get_tight_layout_figure
  •    no_go = [ax for ax in self.axes if not isinstance(ax, SubplotBase)]
    
  •    if no_go:
    
  •        warnings.Warn("Cannot use tight_layout;"
    
  •                      " all Axes must descend from SubplotBase")
    
  •        return
    
  •    subplot_axes = [ax for ax in self.axes if isinstance(ax, SubplotBase)]
    
  •    if len(subplot_axes) < len(self.axes):
    
  •        warnings.warn("tight_layout can only process Axes that descend "
    

I think the word "descend" here is a bit confusing. I think the more
commonly used term in OO is "inherit". If there's no objections, since
this is already merged, I'll just go ahead and fix this directly on master.

I agree; I noticed the same thing, but didn't think to correct it. Go
ahead if you have not already done so.

"from SubplotBase; results might be incorrect.")

if renderer is None:
renderer = get_renderer(self)

kwargs = get_tight_layout_figure(self, self.axes, renderer,
kwargs = get_tight_layout_figure(self, subplot_axes, renderer,
pad=pad, h_pad=h_pad, w_pad=w_pad,
rect=rect)

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.