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

Skip to content

Commit 6180df7

Browse files
committed
TST: update constrained_layout images
1 parent 8e070e8 commit 6180df7

17 files changed

+4
-30
lines changed

lib/matplotlib/colorbar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ def __call__(self):
248248
ticks = super().__call__()
249249
return self._trim_ticks(np.asarray(ticks))
250250

251-
252251
def tick_values(self, vmin, vmax):
253252
if vmin is not None and vmax is not None and vmin > vmax:
254253
vmax, vmin = vmin, vmax
@@ -537,7 +536,8 @@ def _get_ticker_locator_formatter(self):
537536
minorlocator = self.minorlocator
538537
minorformatter = self.minorformatter
539538

540-
if self.boundaries is None:
539+
if (self.boundaries is None and
540+
not isinstance(self.norm, colors.BoundaryNorm)):
541541
if locator is None:
542542
locator = _LocatorWrapper(
543543
self._long_axis().get_major_locator(), colorbar=self)

lib/matplotlib/scale.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ def forward(values: array-like) -> array-like
178178
self._transform = transform
179179
self._kwargs = {'functions': functions}
180180

181-
182181
def get_transform(self):
183182
"""Return the `.FuncTransform` associated with this scale."""
184183
return self._transform
@@ -578,8 +577,7 @@ def __init__(self, axis, nonpositive='mask', *,
578577
self._use_overline = use_overline
579578
self._one_half = one_half
580579
self._kwargs = {'nonpositive': nonpositive, 'one_half': one_half,
581-
'use_overline':use_overline}
582-
580+
'use_overline': use_overline}
583581

584582
def get_transform(self):
585583
"""Return the `.LogitTransform` associated with this scale."""

lib/matplotlib/tests/test_constrainedlayout.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ def test_constrained_layout2():
5151
@image_comparison(['constrained_layout3.png'])
5252
def test_constrained_layout3():
5353
"""Test constrained_layout for colorbars with subplots"""
54-
# Remove this line when this test image is regenerated.
55-
plt.rcParams['pcolormesh.snap'] = False
5654

5755
fig, axs = plt.subplots(2, 2, constrained_layout=True)
5856
for nn, ax in enumerate(axs.flat):
@@ -67,8 +65,6 @@ def test_constrained_layout3():
6765
@image_comparison(['constrained_layout4.png'])
6866
def test_constrained_layout4():
6967
"""Test constrained_layout for a single colorbar with subplots"""
70-
# Remove this line when this test image is regenerated.
71-
plt.rcParams['pcolormesh.snap'] = False
7268

7369
fig, axs = plt.subplots(2, 2, constrained_layout=True)
7470
for ax in axs.flat:
@@ -82,8 +78,6 @@ def test_constrained_layout5():
8278
Test constrained_layout for a single colorbar with subplots,
8379
colorbar bottom
8480
"""
85-
# Remove this line when this test image is regenerated.
86-
plt.rcParams['pcolormesh.snap'] = False
8781

8882
fig, axs = plt.subplots(2, 2, constrained_layout=True)
8983
for ax in axs.flat:
@@ -96,8 +90,6 @@ def test_constrained_layout5():
9690
@image_comparison(['constrained_layout6.png'], tol=0.002)
9791
def test_constrained_layout6():
9892
"""Test constrained_layout for nested gridspecs"""
99-
# Remove this line when this test image is regenerated.
100-
plt.rcParams['pcolormesh.snap'] = False
10193

10294
fig = plt.figure(constrained_layout=True)
10395
gs = fig.add_gridspec(1, 2, figure=fig)
@@ -139,8 +131,6 @@ def test_constrained_layout7():
139131
@image_comparison(['constrained_layout8.png'])
140132
def test_constrained_layout8():
141133
"""Test for gridspecs that are not completely full"""
142-
# Remove this line when this test image is regenerated.
143-
plt.rcParams['pcolormesh.snap'] = False
144134

145135
fig = plt.figure(figsize=(10, 5), constrained_layout=True)
146136
gs = gridspec.GridSpec(3, 5, figure=fig)
@@ -169,8 +159,6 @@ def test_constrained_layout8():
169159
@image_comparison(['constrained_layout9.png'])
170160
def test_constrained_layout9():
171161
"""Test for handling suptitle and for sharex and sharey"""
172-
# Remove this line when this test image is regenerated.
173-
plt.rcParams['pcolormesh.snap'] = False
174162

175163
fig, axs = plt.subplots(2, 2, constrained_layout=True,
176164
sharex=False, sharey=False)
@@ -195,8 +183,6 @@ def test_constrained_layout10():
195183
@image_comparison(['constrained_layout11.png'])
196184
def test_constrained_layout11():
197185
"""Test for multiple nested gridspecs"""
198-
# Remove this line when this test image is regenerated.
199-
plt.rcParams['pcolormesh.snap'] = False
200186

201187
fig = plt.figure(constrained_layout=True, figsize=(13, 3))
202188
gs0 = gridspec.GridSpec(1, 2, figure=fig)
@@ -217,8 +203,6 @@ def test_constrained_layout11():
217203
@image_comparison(['constrained_layout11rat.png'])
218204
def test_constrained_layout11rat():
219205
"""Test for multiple nested gridspecs with width_ratios"""
220-
# Remove this line when this test image is regenerated.
221-
plt.rcParams['pcolormesh.snap'] = False
222206

223207
fig = plt.figure(constrained_layout=True, figsize=(10, 3))
224208
gs0 = gridspec.GridSpec(1, 2, figure=fig, width_ratios=[6, 1])
@@ -261,8 +245,6 @@ def test_constrained_layout12():
261245
@image_comparison(['constrained_layout13.png'], tol=2.e-2)
262246
def test_constrained_layout13():
263247
"""Test that padding works."""
264-
# Remove this line when this test image is regenerated.
265-
plt.rcParams['pcolormesh.snap'] = False
266248

267249
fig, axs = plt.subplots(2, 2, constrained_layout=True)
268250
for ax in axs.flat:
@@ -274,8 +256,6 @@ def test_constrained_layout13():
274256
@image_comparison(['constrained_layout14.png'])
275257
def test_constrained_layout14():
276258
"""Test that padding works."""
277-
# Remove this line when this test image is regenerated.
278-
plt.rcParams['pcolormesh.snap'] = False
279259

280260
fig, axs = plt.subplots(2, 2, constrained_layout=True)
281261
for ax in axs.flat:
@@ -402,9 +382,6 @@ def test_colorbar_location():
402382
Test that colorbar handling is as expected for various complicated
403383
cases...
404384
"""
405-
# Remove this line when this test image is regenerated.
406-
plt.rcParams['pcolormesh.snap'] = False
407-
408385
fig, axs = plt.subplots(4, 5, constrained_layout=True)
409386
for ax in axs.flat:
410387
pcm = example_pcolor(ax)

lib/matplotlib/tests/test_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ def test_image_preserve_size2():
786786
np.identity(n, bool)[::-1])
787787

788788

789-
@image_comparison(['mask_image_over_under.png'], remove_text=False, tol=1.0)
789+
@image_comparison(['mask_image_over_under.png'], remove_text=True, tol=1.0)
790790
def test_mask_image_over_under():
791791
# Remove this line when this test image is regenerated.
792792
plt.rcParams['pcolormesh.snap'] = False

lib/mpl_toolkits/tests/test_axes_grid.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,3 @@ def test_imagegrid():
6363
ax = grid[0]
6464
im = ax.imshow([[1, 2]], norm=mpl.colors.LogNorm())
6565
cb = ax.cax.colorbar(im)
66-
assert isinstance(cb.locator, mpl.colorbar._ColorbarLogLocator)

0 commit comments

Comments
 (0)