mpldatacursor
mpldatacursor copied to clipboard
Warning when used with surface plots
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()
That is a harmless warning that has (iirc) been fixed upstream.