Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

seaborn pandas annotate

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns


d = {'group': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
     'y': [100, 200, 300, 400, 500, 650, 780, 810, 932, 1050],
     'flag': [1503, 601, 348, 193, 161, 197, 322, 237, 85, 38]}
df = pd.DataFrame(d)
g = sns.lineplot(x = 'group', y = 'y', marker='.', data = df).set_title('Example Graph')

# add labels here
for v in df.iterrows():
    plt.text(v[1][0], v[1][1], f'{v[1][2]}')
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #seaborn #pandas #annotate
ADD COMMENT
Topic
Name
4+2 =