0

I'm using plt.annotate to annotate plots. I'm using a for loop to annotate several data points at the same time, however due to overlapping data points the text is overlapping too, making data interpretation quite troublesome. Any ideas how i can circumvent this issue? Here's my code and the plot!

plt.figure(figsize = (12,8))
sns.regplot(data = plot_data, x = x, y = y, ci = False,  truncate = False)

#idx to be annotated
idx = plot_data[(plot_data[x] > 2) | (plot_data[y] > 2)].index

for i in idx:
        plt.annotate(text = fc_data_comb["PG.Genes"][i],
                     xy = (fc_data_comb[x][i], fc_data_comb[y][i]),
                     xytext = (fc_data_comb[x][i], fc_data_comb[y][i]),)

enter image description here

Alex L
  • 117
  • 7

0 Answers0