Closed
Description
Bug summary
imshow extents cannot be expressed with units.
Code for reproduction
fig, ax = plt.subplots()
dates = np.arange("2020-01-01","2020-01-10 23:00", dtype='datetime64[h]')
ys = np.random.random(dates.size)
arr = np.random.random((10, 10))
ax.imshow(arr, extent=[dates[0], dates[1], 0, 10])
Actual outcome
Traceback (most recent call last):
File "/Users/jklymak/matplotlib/testImshow.py", line 12, in <module>
ax.imshow(arr, extent=[dates[0], dates[1], 0, 10])
File "/Users/jklymak/matplotlib/lib/matplotlib/_api/deprecation.py", line 456, in wrapper
return func(*args, **kwargs)
File "/Users/jklymak/matplotlib/lib/matplotlib/__init__.py", line 1413, in inner
return func(ax, *map(sanitize_sequence, args), **kwargs)
File "/Users/jklymak/matplotlib/lib/matplotlib/axes/_axes.py", line 5504, in imshow
im.set_extent(im.get_extent())
File "/Users/jklymak/matplotlib/lib/matplotlib/image.py", line 955, in set_extent
self.axes.update_datalim(corners)
File "/Users/jklymak/matplotlib/lib/matplotlib/axes/_base.py", line 2477, in update_datalim
if not np.any(np.isfinite(xys)):
TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
Expected outcome
the extents are passed through the units machinery....
Additional information
No response
Operating system
No response
Matplotlib Version
master
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
No response