8000 FIX: add test tolerance · matplotlib/matplotlib@34329d2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 34329d2

Browse files
committed
FIX: add test tolerance
1 parent 7ce4a7e commit 34329d2

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/matplotlib/colorbar.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,10 +1151,9 @@ def _mesh(self):
11511151
def _forward_boundaries(self, x):
11521152
# map boundaries equally between 0 and 1...
11531153
b = self._boundaries
1154-
db = b[-1] - b[0]
11551154
y = np.interp(x, b, np.linspace(0, 1, len(b)))
11561155
# the following avoids ticks in the extends:
1157-
eps = db * 1e-6
1156+
eps = (b[-1] - b[0]) * 1e-6
11581157
# map these _well_ out of bounds to keep any ticks out
11591158
# of the extends region...
11601159
y[x < b[0]-eps] = -1

lib/matplotlib/tests/test_contour.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,12 @@ def test_clabel_zorder(use_clabeltext, contour_zorder, clabel_zorder):
305305
assert clabel.get_zorder() == expected_clabel_zorder
306306

307307

308+
# tol because ticks happen to fall on pixel boundaries so small
309+
# floating point changes in tick location flip which pixel gets
310+
# the tick.
308311
@image_comparison(['contour_log_extension.png'],
309-
remove_text=True, style='mpl20')
312+
remove_text=True, style='mpl20',
313+
tol=1.444)
310314
def test_contourf_log_extension():
311315
# Remove this line when this test image is regenerated.
312316
plt.rcParams['pcolormesh.snap'] = False

0 commit comments

Comments
 (0)
0