Skip to content

Commit 8d04411

Browse files
committed
TST/FLK8
1 parent 864365a commit 8d04411

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

examples/subplots_axes_and_figures/compress_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
compress_layout=True)
5151
for ax in axs.flat:
5252
ax.set_aspect(1.0)
53-
pc = ax.pcolormesh(np.random.randn(20,20))
53+
pc = ax.pcolormesh(np.random.randn(20, 20))
5454
fig.colorbar(pc, ax=ax)
5555
plt.show()
5656

lib/matplotlib/_compress_layout.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def compress_layout(fig, *, bboxes=None, w_pad=0.05, h_pad=0.05,
7272
dxs[i, j] = dxs[i, j] + pad / di
7373
dys[i, j] = bboxes[ax].bounds[3] / dj
7474
pad = np.max([h_pad, hspace * bboxes[ax].bounds[3]])
75-
if ss.rowspan[0] > 0 :
75+
if ss.rowspan[0] > 0:
7676
dys[i, j] = dys[i, j] + pad / dj
7777
margxs[i, j] = orpos.x0 - bboxes[ax].x0
7878
margys[i, j] = orpos.y0 - bboxes[ax].y0
@@ -117,8 +117,8 @@ def compress_layout(fig, *, bboxes=None, w_pad=0.05, h_pad=0.05,
117117
if cba._colorbar_info['location'] in ['bottom', 'top']:
118118
# shrink to make same size as active...
119119
posac = ax.get_position(original=False)
120-
dx = (1 - cba._colorbar_info['shrink']) * (posac.x1 -
121-
posac.x0) / 2
120+
dx = ((1 - cba._colorbar_info['shrink']) *
121+
(posac.x1 posac.x0) / 2)
122122
pos.x0 = posac.x0 + dx
123123
pos.x1 = posac.x1 - dx
124124
else:
@@ -143,7 +143,7 @@ def compress_layout(fig, *, bboxes=None, w_pad=0.05, h_pad=0.05,
143143
pos.x1 = x - marg
144144
pos.x0 = x - marg - _dx
145145
else:
146-
ddx = (x1 - x0) * (1 - cb._colorbar_info['shrink']) / 2
146+
ddx = (x1 - x0) * (1 - cb._colorbar_info['shrink']) / 2
147147
marg = bbox.x0 - pos.x0
148148
pos.x0 = x0 - marg + ddx
149149
marg = bbox.x1 - pos.x1
@@ -177,10 +177,10 @@ def compress_layout(fig, *, bboxes=None, w_pad=0.05, h_pad=0.05,
177177
if cba._colorbar_info['location'] in ['right', 'left']:
178178
# shrink to make same size as active...
179179
posac = ax.get_position(original=False)
180-
ddy_ = (1 - cba._colorbar_info['shrink']) * (posac.y1 -
181-
posac.y0) / 2
182-
pos.y0 = posac.y0 + ddy_
183-
pos.y1 = posac.y1 - ddy_
180+
ddy = ((1 - cba._colorbar_info['shrink']) *
181+
(posac.y1 - posac.y0) / 2)
182+
pos.y0 = posac.y0 + ddy
183+
pos.y1 = posac.y1 - ddy
184184
else:
185185
pos.y0 = pos.y0 + deltay
186186
pos.y1 = pos.y1 + deltay
@@ -204,7 +204,7 @@ def compress_layout(fig, *, bboxes=None, w_pad=0.05, h_pad=0.05,
204204
pos.y1 = y - marg
205205
pos.y0 = y - marg - _dy
206206
else:
207-
ddy = (y1 - y0) * (1 - cb._colorbar_info['shrink']) / 2
207+
ddy = (y1 - y0) * (1 - cb._colorbar_info['shrink']) / 2
208208
marg = bbox.y0 - pos.y0
209209
pos.y0 = y0 - marg + ddy
210210
marg = bbox.y1 - pos.y1

lib/matplotlib/_constrained_layout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def _make_layout_margins(ax, renderer, h_pad, w_pad):
264264
*axes* layoutbox be a minimum size that can accommodate the
265265
decorations on the axis.
266266
267-
Returns the bbox for some width/heigth calcs outside this loop.
267+
Returns the bbox for some width/height calcs outside this loop.
268268
"""
269269
fig = ax.figure
270270
invTransFig = fig.transFigure.inverted().transform_bbox

lib/matplotlib/figure.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import logging
1212
from numbers import Integral
13-
import warnings
1413

1514
import numpy as np
1615

lib/matplotlib/tests/test_constrainedlayout.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ def test_hidden_axes():
400400
np.testing.assert_allclose(
401401
extents1, [0.045552, 0.548288, 0.47319, 0.982638], rtol=1e-5)
402402

403+
403404
def test_compressed():
404405
# Test that the compressed layout option works:
405406
fig, axs = plt.subplots(2, 2, constrained_layout=True,
@@ -431,6 +432,7 @@ def test_compressed_cbars():
431432
np.testing.assert_allclose(extents,
432433
[0.119849, 0.571899, 0.355875, 0.965277], rtol=1e-5)
433434

435+
434436
def test_compressed_onecbar():
435437
# Test that the compressed layout option works:
436438
fig, axs = plt.subplots(2, 2, constrained_layout=True,

0 commit comments

Comments
 (0)