Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Backport: resolve conflict to get this into v2.2.3 #11811

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 2 commits into from
Aug 4, 2018
Merged
Show file tree
Hide file tree
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
9 changes: 4 additions & 5 deletions lib/matplotlib/_constrained_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def do_constrained_layout(fig, renderer, h_pad, w_pad,
# This routine makes all the subplot spec containers
# have the correct arrangement. It just stacks the
# subplot layoutboxes in the correct order...
arange_subplotspecs(child, hspace=hspace, wspace=wspace)
_arange_subplotspecs(child, hspace=hspace, wspace=wspace)

# - Align right/left and bottom/top spines of appropriate subplots.
# - Compare size of subplotspec including height and width ratios
Expand Down Expand Up @@ -443,7 +443,7 @@ def do_constrained_layout(fig, renderer, h_pad, w_pad,
ax._set_position(newpos, which='original')


def arange_subplotspecs(gs, hspace=0, wspace=0):
def _arange_subplotspecs(gs, hspace=0, wspace=0):
"""
arange the subplotspec children of this gridspec, and then recursively
do the same of any gridspec children of those gridspecs...
Expand All @@ -453,9 +453,8 @@ def arange_subplotspecs(gs, hspace=0, wspace=0):
if child._is_subplotspec_layoutbox():
for child2 in child.children:
# check for gridspec children...
name = (child2.name).split('.')[-1][:-3]
if name == 'gridspec':
arange_subplotspecs(child2, hspace=hspace, wspace=wspace)
if child2._is_gridspec_layoutbox():
_arange_subplotspecs(child2, hspace=hspace, wspace=wspace)
sschildren += [child]
# now arrange the subplots...
for child0 in sschildren:
Expand Down
14 changes: 5 additions & 9 deletions lib/matplotlib/_layoutbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,20 +358,16 @@ def _is_subplotspec_layoutbox(self):
Helper to check if this layoutbox is the layoutbox of a
subplotspec
'''
name = (self.name).split('.')[-1][:-3]
if name == 'ss':
return True
return False
name = (self.name).split('.')[-1]
return name[:2] == 'ss'

def _is_gridspec_layoutbox(self):
'''
Helper to check if this layoutbox is the layoutbox of a
gridspec
'''
name = (self.name).split('.')[-1][:-3]
if name == 'gridspec':
return True
return False
name = (self.name).split('.')[-1]
return name[:8] == 'gridspec'

def find_child_subplots(self):
'''
Expand Down Expand Up @@ -650,7 +646,7 @@ def seq_id():

global _layoutboxobjnum

return ('%03d' % (next(_layoutboxobjnum)))
return ('%06d' % (next(_layoutboxobjnum)))


def print_children(lb):
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3996,7 +3996,7 @@ def test_psd_noise():


@image_comparison(baseline_images=['csd_freqs'], remove_text=True,
extensions=['png'])
extensions=['png'], tol=0.002)
def test_csd_freqs():
'''test axes.csd with sinusoidal stimuli'''
n = 10000
Expand Down