I'm still a beginner and I'm trying to make the edge of the bar of the chart be highlighted (change color) in a mouse movement event when hovering over it. Only the bar over which the mouse hovers should be highlighted. The code shows an error: AttributeError: 'NoneType' object has no attribute 'patch'.
How it should look with the movement of the mouse over the bar.
import seaborn as sb
import matplotlib.pyplot as plt
import matplotlib.patches
%matplotlib qt
df = sb.load_dataset('titanic')
f, ax = plt.subplots(figsize=(6, 4))
ax = sb.barplot(data = df, y = 'class', x = 'fare')#, edgecolor='k')
ax.grid(linestyle='--', zorder=0, axis='x')
f.tight_layout()
def hover(event):
if event.y:
event.inaxes.patch.set_edgecolor('k')
ax.figure.canvas.mpl_connect('motion_notify_event', hover)
I tried to make hovering the mouse over a bar of the graph, the same if highlighted from the others create an outline (border) in it.