I have produced the following plot using the following code
np.random.seed(1)
points = np.random.uniform(0,1, size = (1000,2)
values = np.random.uniform(-1,1, size = 1000)
plt.scatter(*points.T, c=values cmap = ListedColormap(sns.color_palette('coolwarm'))
Now, I would like to be able to hover the mouse over the points and see what value in values
they correspond to. Obviously, I could simply use a plt.colorbar()
as seen in the next image
by using the following code
sp = plt.scatter(*points.T, c=values cmap = ListedColormap(sns.color_palette('coolwarm'))
plt.colorbar(sp)
plt.show()
However while you are looking at the plot, it is a bit harder to really get the values, and it would be way too messy to put labels on the points. Thus why I want to make the plot interactive. I had a look at matplotlib event handling and at the library plot.ly.
They both seem to say that the can indeed do it (for instance, look here) but none seems to explain how!
Any ideas?