joferkington / mpldatacursor

Interactive "data cursors" (a.k.a. annotation pop-ups) for matplotlib
MIT License
194 stars 47 forks source link

Warning when used with surface plots #79

Open bwohlberg opened 7 years ago

bwohlberg commented 7 years ago

The data cursor seems to function correctly when used with a surface plot, but the first click to place the cursor results in the warning

/usr/lib/python3/dist-packages/matplotlib/collections.py:360: UserWarning: Collection picker None could not be converted to float % self._picker)

Minimal example demonstrating the problem below:

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import mpldatacursor as mpldc

x = np.linspace(-1, 1, 10)[np.newaxis]
y = x.T
z = np.sqrt(x**2 + y**2)

fig = plt.figure()
ax = plt.axes(projection='3d')
xg, yg = np.meshgrid(x, y)
ax.plot_surface(xg, yg, z, rstride=1, cstride=1)
mpldc.datacursor()
plt.show()
tacaswell commented 7 years ago

That is a harmless warning that has (iirc) been fixed upstream.