mpldatacursor icon indicating copy to clipboard operation
mpldatacursor copied to clipboard

issues with errorbar

Open jacobpierce1 opened this issue 7 years ago • 0 comments

Hi, thanks for the excellent library. I am trying to extend the basic example of matplotlib.pyplot.scatter to matplotlib.pyplot.errorbar without success. Example code:

import numpy as np
import matplotlib.pyplot as plt
import mpldatacursor

x, y, z = np.random.random((3, 10))
fig, ax = plt.subplots()

# works as expected with this uncommented:
# ax.scatter(x, y, label = 'test' )

# doesn't work with an errorbar:
ax.errorbar(x, y, xerr=1, yerr=1, ls='none', label = 'test' )



mpldatacursor.datacursor( formatter = '{label}'.format )
plt.show( )
 

The expected behavior is that when one of the errorbars is clicked on, the mpldatacursor will show 'test', as it does with the scatter plot. Instead, it shows '_nolegend_'. Not sure if it's a bug or if I'm just not using the mpldatacursor correctly.

jacobpierce1 avatar Dec 07 '17 02:12 jacobpierce1