Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1065 from pwuertz/tight-layout-dpi-fix

fixed conversion from pt to inch in tight_layout
  • Loading branch information...
commit e6818e7422a5d464e2b010f100bddfe084572f5a 2 parents 267b0cf + 754535b
Benjamin Root WeatherGod authored
2  lib/matplotlib/figure.py
View
@@ -1361,7 +1361,7 @@ def get_tightbbox(self, renderer):
return bbox_inches
- def tight_layout(self, renderer=None, pad=1.2, h_pad=None, w_pad=None, rect=None):
+ def tight_layout(self, renderer=None, pad=1.08, h_pad=None, w_pad=None, rect=None):
"""
Adjust subplot parameters to give specified padding.
2  lib/matplotlib/gridspec.py
View
@@ -270,7 +270,7 @@ def locally_modified_subplot_params(self):
return [k for k in self._AllowedKeys if getattr(self, k)]
- def tight_layout(self, fig, renderer=None, pad=1.2, h_pad=None, w_pad=None, rect=None):
+ def tight_layout(self, fig, renderer=None, pad=1.08, h_pad=None, w_pad=None, rect=None):
"""
Adjust subplot parameters to give specified padding.
2  lib/matplotlib/pyplot.py
View
@@ -1114,7 +1114,7 @@ def subplot_tool(targetfig=None):
-def tight_layout(pad=1.2, h_pad=None, w_pad=None, rect=None):
+def tight_layout(pad=1.08, h_pad=None, w_pad=None, rect=None):
"""
Adjust subplot parameters to give specified padding.
4 lib/matplotlib/tests/test_tightlayout.py
View
@@ -110,7 +110,7 @@ def test_tight_layout6():
ax.set_xlabel("x-label", fontsize=12)
- gs2.tight_layout(fig, rect=[0.5, 0, 1, 1], h_pad=0.5)
+ gs2.tight_layout(fig, rect=[0.5, 0, 1, 1], h_pad=0.45)
top = min(gs1.top, gs2.top)
bottom = max(gs1.bottom, gs2.bottom)
@@ -119,5 +119,5 @@ def test_tight_layout6():
0.5, 1 - (gs1.top-top)])
gs2.tight_layout(fig, rect=[0.5, 0 + (bottom-gs2.bottom),
None, 1 - (gs2.top-top)],
- h_pad=0.5)
+ h_pad=0.45)
10 lib/matplotlib/tight_layout.py
View
@@ -38,7 +38,7 @@ def auto_adjust_subplotpars(fig, renderer,
num1num2_list,
subplot_list,
ax_bbox_list=None,
- pad=1.2, h_pad=None, w_pad=None,
+ pad=1.08, h_pad=None, w_pad=None,
rect=None):
"""
Return a dictionary of subplot parameters so that spacing between
@@ -71,15 +71,15 @@ def auto_adjust_subplotpars(fig, renderer,
rows, cols = nrows_ncols
- pad_inches = pad * FontProperties(size=rcParams["font.size"]).get_size_in_points() / renderer.dpi
+ pad_inches = pad * FontProperties(size=rcParams["font.size"]).get_size_in_points() / 72.
if h_pad is not None:
- vpad_inches = h_pad * FontProperties(size=rcParams["font.size"]).get_size_in_points() / renderer.dpi
+ vpad_inches = h_pad * FontProperties(size=rcParams["font.size"]).get_size_in_points() / 72.
else:
vpad_inches = pad_inches
if w_pad is not None:
- hpad_inches = w_pad * FontProperties(size=rcParams["font.size"]).get_size_in_points() / renderer.dpi
+ hpad_inches = w_pad * FontProperties(size=rcParams["font.size"]).get_size_in_points() / 72.
else:
hpad_inches = pad_inches
@@ -210,7 +210,7 @@ def get_renderer(fig):
def get_tight_layout_figure(fig, axes_list, renderer,
- pad=1.2, h_pad=None, w_pad=None, rect=None):
+ pad=1.08, h_pad=None, w_pad=None, rect=None):
"""
return subplot parameters for tigh-layouted- figure with
specified padding.
Please sign in to comment.
Something went wrong with that request. Please try again.