Does anybody know why I would be getting "_line0" on certain points when using mplcursor hover on rectangles? I created a bunch of rectangles in a subplot and used the following code to create a cursor to show annotation when hovering over them:
def update_annotation(sel):
""" update the annotation belonging to the current selected item (sel) """
# get the label of the graphical element that is selected
label = sel.artist.get_label()
#point = sel.artist[sel.target.index]
# change the text of the annotation
sel.annotation.set_text(label)
sel.annotation.set(position=(1, 10), anncoords="offset points")
sel.annotation.get_bbox_patch().set(fc="yellow", alpha = 1)
sel.annotation.arrow_patch.set(arrowstyle="simple", fc="yellow", alpha=.5)
# create an mplcursor object that shows an annotation while hovering
cursor = mplcursors.cursor(axs[1], hover=True)
# call the function "update_annotation" each time a new element gets hovered over
cursor.connect("add", update_annotation)
However, when I hover over certain datapoint, not only is it REALLY slow to go to where I'm hovering over but it also shows me this:
My guess is that there are too many overlapping data points? If so, does anybody know a way around that and also can somebody explain to me what _line0 even means?
I realize the cursor is hovering over an empty space in the plot but it also shows _line0 when I hover over rectangles. Sometimes it will even show the label and then go back to _line0.
