-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Closed
Description
The addition of this code block to ColorbarBase._ticker in matplotlib 1.5.x:
if isinstance(locator, ticker.LogLocator):
eps = 1e-10
b = b[(b <= intv[1] * (1 + eps)) & (b >= intv[0] * (1 - eps))]
else:
eps = (intv[1] - intv[0]) * 1e-10
b = b[(b <= intv[1] + eps) & (b >= intv[0] - eps)]can cause a numpy array scalar to be passed to ColorbarBase._locate but when that happens the np.searchsorted call in _locate returns an numpy.int64 scalar, which causes the indexing operations:
i0[itop] -= 1
ii[itop] -= 1
i0[ibot] += 1
ii[ibot] += 1to generate the exception: 'numpy.int64' object does not support item assignment.
My quick and dirty patch for this was to add this line before the np.searchsorted call in _locate:
if np.ndim(xn) == 0: xn = np.array([xn[()]])I don't propose this as a formal patch since it may not be the most efficient fix and this issue may be broader than what I am seeing.
Specs:
- Windows 10 64-bit
- Python 2.7.11 64-bit (python.org installer)
- matplotlib 1.5.1 (pip install)
- Regression: OK in 1.4.3
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels