Phlya / adjustText

A small library for automatically adjustment of text position in matplotlib plots to minimize overlaps.
https://adjusttext.readthedocs.io/
MIT License
1.49k stars 87 forks source link

Making this work with seaborn plots #116

Open kevalshah90 opened 3 years ago

kevalshah90 commented 3 years ago
ax = sns.scatterplot(x='col1', y='col2', data = df1)

for line in range(0,df1.shape[0]):
     ax.text(df1.col1[line]+0.4, df1.col2[line], 
                 df1.col3[line], color='black', weight='semibold')

# get labels

texts = [ax.text(df1['col1'], 
                           df1['col2'], 
                           df1['col3']) for i in range(len(df1))]
adjust_text(texts)