8000 FIX · matplotlib/matplotlib@7ce4a7e · GitHub
[go: up one dir, main page]

Skip to content

Commit 7ce4a7e

Browse files
committed
FIX
1 parent 3a43af7 commit 7ce4a7e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/matplotlib/colorbar.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,18 +1149,22 @@ def _mesh(self):
11491149
return (Y, X, extendlen)
11501150

11511151
def _forward_boundaries(self, x):
1152+
# map boundaries equally between 0 and 1...
11521153
b = self._boundaries
11531154
db = b[-1] - b[0]
1154-
y = np.interp(x, b, np.linspace(0, db, len(b)))
1155+
y = np.interp(x, b, np.linspace(0, 1, len(b)))
11551156
# the following avoids ticks in the extends:
11561157
eps = db * 1e-6
1157-
y[x < b[0]-eps] = -1 * db
1158-
y[x > b[-1]+eps] = b[-1] + db
1158+
# map these _well_ out of bounds to keep any ticks out
1159+
# of the extends region...
1160+
y[x < b[0]-eps] = -1
1161+
y[x > b[-1]+eps] = 2
11591162
return y
11601163

11611164
def _inverse_boundaries(self, x):
1165+
# invert the above...
11621166
b = self._boundaries
1163-
return np.interp(x, np.linspace(0, b[-1]-b[0], len(b)), b)
1167+
return np.interp(x, np.linspace(0, 1, len(b)), b)
11641168

11651169
def _reset_locator_formatter_scale(self):
11661170
"""

0 commit comments

Comments
 (0)
0