10000 FIX · matplotlib/matplotlib@3a43af7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3a43af7

Browse files
committed
FIX
1 parent 6d329fa commit 3a43af7

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/matplotlib/colorbar.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,15 +1150,17 @@ def _mesh(self):
11501150

11511151
def _forward_boundaries(self, x):
11521152
b = self._boundaries
1153-
y = np.interp(x, b, np.linspace(0, b[-1]-b[0], len(b)))
1154-
eps = (b[-1] - b[0]) * 1e-6
1155-
y[x < b[0]-eps] = -1
1156-
y[x > b[-1]+eps] = 2
1153+
db = b[-1] - b[0]
1154+
y = np.interp(x, b, np.linspace(0, db, len(b)))
1155+
# the following avoids ticks in the extends:
1156+
eps = db * 1e-6
1157+
y[x < b[0]-eps] = -1 * db
1158+
y[x > b[-1]+eps] = b[-1] + db
11571159
return y
11581160

11591161
def _inverse_boundaries(self, x):
11601162
b = self._boundaries
1161-
return np.interp(x, np.linspace(0, b[-1], len(b)), b)
1163+
return np.interp(x, np.linspace(0, b[-1]-b[0], len(b)), b)
11621164

11631165
def _reset_locator_formatter_scale(self):
11641166
"""

0 commit comments

Comments
 (0)
0