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

Skip to content

Commit 754535b

Browse files
author
pwuertz
committed
restore previous tight_layout padding results by correcting the defaults
1 parent 74093a6 commit 754535b

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

lib/matplotlib/figure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,7 @@ def get_tightbbox(self, renderer):
13611361

13621362
return bbox_inches
13631363

1364-
def tight_layout(self, renderer=None, pad=1.2, h_pad=None, w_pad=None, rect=None):
1364+
def tight_layout(self, renderer=None, pad=1.08, h_pad=None, w_pad=None, rect=None):
13651365
"""
13661366
Adjust subplot parameters to give specified padding.
13671367

lib/matplotlib/gridspec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ def locally_modified_subplot_params(self):
270270
return [k for k in self._AllowedKeys if getattr(self, k)]
271271

272272

273-
def tight_layout(self, fig, renderer=None, pad=1.2, h_pad=None, w_pad=None, rect=None):
273+
def tight_layout(self, fig, renderer=None, pad=1.08, h_pad=None, w_pad=None, rect=None):
274274
"""
275275
Adjust subplot parameters to give specified padding.
276276

lib/matplotlib/pyplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ def subplot_tool(targetfig=None):
11141114

11151115

11161116

1117-
def tight_layout(pad=1.2, h_pad=None, w_pad=None, rect=None):
1117+
def tight_layout(pad=1.08, h_pad=None, w_pad=None, rect=None):
11181118
"""
11191119
Adjust subplot parameters to give specified padding.
11201120

lib/matplotlib/tests/test_tightlayout.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def test_tight_layout6():
110110

111111
ax.set_xlabel("x-label", fontsize=12)
112112

113-
gs2.tight_layout(fig, rect=[0.5, 0, 1, 1], h_pad=0.5)
113+
gs2.tight_layout(fig, rect=[0.5, 0, 1, 1], h_pad=0.45)
114114

115115
top = min(gs1.top, gs2.top)
116116
bottom = max(gs1.bottom, gs2.bottom)
@@ -119,5 +119,5 @@ def test_tight_layout6():
119119
0.5, 1 - (gs1.top-top)])
120120
gs2.tight_layout(fig, rect=[0.5, 0 + (bottom-gs2.bottom),
121121
None, 1 - (gs2.top-top)],
122-
h_pad=0.5)
122+
h_pad=0.45)
123123

lib/matplotlib/tight_layout.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def auto_adjust_subplotpars(fig, renderer,
3838
num1num2_list,
3939
subplot_list,
4040
ax_bbox_list=None,
41-
pad=1.2, h_pad=None, w_pad=None,
41+
pad=1.08, h_pad=None, w_pad=None,
4242
rect=None):
4343
"""
4444
Return a dictionary of subplot parameters so that spacing between
@@ -210,7 +210,7 @@ def get_renderer(fig):
210210

211211

212212
def get_tight_layout_figure(fig, axes_list, renderer,
213-
pad=1.2, h_pad=None, w_pad=None, rect=None):
213+
pad=1.08, h_pad=None, w_pad=None, rect=None):
214214
"""
215215
return subplot parameters for tigh-layouted- figure with
216216
specified padding.

0 commit comments

Comments
 (0)