Description
Bug report
Bug summary
When using matplotlib.image.NonUniformImage
, the coordinates of the cursor are wrong: the Z-coordinate is inconsistent with the image (it appears to be based on how imshow
would display the data (flipped in Y)).
The Z values also don't change at the visible boundaries between "pixels" or cells, they change somewhere else that might be consistent with different cell alignment to the x,y values.
Code for reproduction
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
ax = plt.gca()
x = np.arange(201)
y = np.arange(201)
z = x[:, np.newaxis] + y[np.newaxis, :]
obj = matplotlib.image.NonUniformImage(ax=ax)
obj.set_data(x, y, z)
ax.add_image(obj)
ax.set_xlim(x.min(), x.max())
ax.set_ylim(y.min(), y.max())
plt.show()
Actual outcome
Notice that when the cursor is at the top right (value should approach 400), the value is about 200. When the cursor is at the bottom right (value should be about 200), the value approaches 400.
Expected outcome
It should be like the actual outcome, but with the correct Z-coordinates reported: should be close to 400 at the top right and close to 200 at the bottom right.
Matplotlib version
- Operating system: Fedora 32
- Matplotlib version: 3.1.2 (installed via pip)
- Matplotlib backend (
print(matplotlib.get_backend())
): Qt5Agg, TkAgg - Python version: 3.8.5
- numpy version: 1.19.1