0

I have the following code to produce a Quadrant chart. However, some of the text is overlaying on top of the adjacent text in the labeling/annotating. Is there a way to repel the text like ggrepel?

Thank you in advance!

    plt.figure(figsize=(10,10))
    plt.rcParams.update({'font.size': 10})
    
    sns.scatterplot(data=df, x='AvgCPC', y='Conversions')
    
    plt.title(f" Exact Match {'AvgCPC'} vs {'Conversions'}")
    plt.xlabel('AvgCPC')
    plt.ylabel('Conversions')
              
    for i in range(df.shape[0]):
              plt.text(df.AvgCPC[i], y=df.Conversions[i], df.index[i],horizontalalignment='right', color='blue')
    
    
    plt.axhline(y=df.Conversions.mean(), color='k', linestyle='--', linewidth=1)           
    plt.axvline(x=df.AvgCPC.mean(), color='k',linestyle='--', linewidth=1)
    plt.show()
ARS
  • 23
  • 4

0 Answers0