I'm a complete noob to web development. I was working on a flask
app which plots multiline charts from pandas dataframe using matplotlib, but I wish to add tooltip to the data points via mpld3
. mpld3
tooltip example is only for scatter plots. How to do this for multiline plots?
data = {'year': [2010, 2011, 2012, 2013, 2014, 2015, 2016,2017, 2018, 2019],
'shop1': [10, 21, 20, 10, 23, 30, 31,45, 23, 56],
'shop2': [10, 21, 20, 10, 12, 30, 78,45, 23, 56],
'shop3': [10, 21, 20, 10, 34, 98, 31,45, 23, 56],}
df = pd.DataFrame(data)
df = df.set_index('year')
fig, ax = plt.subplots()
df.plot(ax=ax, marker='o')
plt.grid(True)
mpld3.display()