I have a test data frame here.
import pandas as pd
import numpy as np
import seaborn as sns
df = pd.DataFrame({'x': [1,2,3,4],
'y': [1,4,9,16],
'z' : ['A','B','C','D']})
This will look as
x y z
0 1 1 A
1 2 4 B
2 3 9 C
3 4 16 D
Now I want to do a seaborn
scatter plot and put tool tips using the z
column. Here is my seaborn
scatter plot code
g = sns.regplot(x=df["x"],
y=df["y"],
fit_reg=False, scatter_kws={'s':30},
color='red')
g.set_title('My Plot')
fig = g.get_figure()
fig.savefig('myplot.png')
Now when I hover over the data point, I want the value of column z
to be displayed for that row. How would I do that ?