1

I have some code, which plots points on graph in matplotlib. Something like this:

import matplotlib.pyplot as plt

points = [
    (0.1, 2.1),
    (0.25, 2.7),
    (0.36, 2.9),
    (0.8, 3.5),
]

x = list(map(lambda x: x[0], points))
y = list(map(lambda x: x[1], points))

plt.scatter(x, y)
plt.grid(True)

plt.show()

And I get following graph: enter image description here

Is there any functionality in matplotlib (or probably any other library I can switch to), where I can click on point, and its coordinates will appear near this point? I know there is such a function in Excel, but I want to do that in Python.

fiendfire28
  • 161
  • 2
  • 10
  • 2
    Yes. I just so happened to [answer a very similar question here](https://stackoverflow.com/a/64528408/6340496). This uses the [Plotly](https://plotly.com/python/) library. – S3DEV Nov 03 '20 at 14:20
  • 1
    https://matplotlib.org/users/event_handling.html – tmdavison Nov 03 '20 at 14:33

0 Answers0