Description
Bug report
Bug summary
When viewing an image with an interactive backend, if multiple images are displayed sequentially in a figure window, the status bar text showing image intensity at a coordinate will be wrong and will refer to a previous image.
Code for reproduction
This should be run from an Ipython / Jupyter / Spyder console
import matplotlib
matplotlib.use('qt5agg')
import matplotlib.pyplot as plt
print(matplotlib.get_backend())
import numpy as np
X0 = np.zeros([100,100])
X1 = np.ones([100,100])
plt.imshow(X0)
#mouseover the image. The status bar will show "x = <coord> y = <coord> [0]"
plt.imshow(X1)
#mouseover the image. The status bar will show "x = <coord> y = <coord> [1]"
plt.imshow(X0)
#mouseover the image. The status bar will show "x = <coord> y = <coord> [1]"
#you may have to repeat the last 2 plt.imshow calls to get this behaviour to appear
Actual outcome
When you mouseover the figure window after displaying multiple figures, when looking at the X/Y coordinates and values in the status bar, the values for each array element are incorrect and refer to a previous image. If X0 is displayed, I expect to see "x = y = [0]" but x = y = [1]" is displayed.
Expected outcome
When you mouseover the figure window, the X/Y coordinates and values in the status bar should be correct and match the image being displayed. If X0 is displayed, I expect to see "x = y = [0]"
Matplotlib version
- Operating system: Windows 10
- Matplotlib version: 2.2.2
- Matplotlib backend (
print(matplotlib.get_backend())
): Qt5Agg - Python version: 3.6.5
- Jupyter version (if applicable): 1.0.0
- Other libraries: numpy 1.14.2
Matplotlib, numpy and python installed from conda (default channel)
This behaviour is observed with qt5agg and tkagg backends but may apply to other interactive backends too.