Closed
Description
Bug report
Bug summary
MouseEvent.x
is an int but MouseEvent.y
is a float.
Code for reproduction
import numpy as np
import matplotlib.pyplot as plt
def onclick(event):
print(event.x, event.y)
print(type(event.x), type(event.y))
plt.imshow(np.zeros((32, 32)))
plt.gcf().canvas.mpl_connect('button_press_event', onclick)
plt.show()
Actual outcome
After randomly clicking on the image:
328 243.0
<class 'int'> <class 'numpy.float64'>
299 148.0
<class 'int'> <class 'numpy.float64'>
260 247.0
<class 'int'> <class 'numpy.float64'>
Expected outcome
328 243
<class 'int'> <class 'int'>
299 148
<class 'int'> <class 'int'>
260 247
<class 'int'> <class 'int'>
Matplotlib version
- Operating system: Ubuntu 18.04
- Matplotlib version: 2.2.2 (installed from pip)
- Matplotlib backend (
print(matplotlib.get_backend())
): TkAgg - Python version: Python 3.6.5
- Jupyter version (if applicable):
- Other libraries:
Metadata
Metadata
Assignees
Labels
Open a pull request against these issues if there are no active ones!Open a pull request against these issues if there are no active ones!