Closed
Description
Bug summary
With imshow() you get an image with values outside the extent being set.
Code for reproduction
import matplotlib.pyplot as plt
import numpy as np
axes = plt.subplot()
axes.set_aspect(1)
axes.format_coord = "x={:1.2f}, y={:1.2f}".format
pltRange = range(-1, 12)
axes.set_xlim(min(pltRange), max(pltRange))
axes.set_ylim(min(pltRange), max(pltRange))
axes.set_xticks(pltRange)
axes.set_yticks(pltRange)
plt.grid(True)
array = np.random.random((10, 10))
image = axes.imshow(array, extent=[0, 10, 0, 10], origin='lower')
image.format_cursor_data = " | Value: {:8f}".format
plt.show()
Actual outcome
On the bottom right you can see the coordinates of the mouse cursor and the value of the array you are moving over. This works fine on the coloured tiles. But I also expect to get no value when I move my mouse over the white plates.
On the top and on the right side, this does happen. But not on the bottom and on the left. If you move your mouse to the position, lets say (-0.5, 2.5), you will still get a value. That makes no sense to me.
Expected outcome
No values on all white tiles.
Matplotlib version
- Operating system: Windows 10 Home, 1809
- Matplotlib version: 3.0.3
- Matplotlib backend: TkAgg
- Python version: 3.7.2
- Other libraries: Numpy 2.16.2
Metadata
Metadata
Assignees
Labels
No labels