0

I have an code below that annotates the scatter points

        for x,y in zip(xs,ys):

            label = "{:.2f}%".format(y)

            plt.annotate(label, # this is the text
                         (x,y), # this is the point to label
                         textcoords="offset points", # how to position the text
                         xytext=(0,10), # distance from text to points (x,y)
                         ha='center') # horizontal alignment can be left, right or center
        

my resulting graph is such: where I have many points too close together that made the annotate overlap. Anyone know how I can avoid it based on my current code?

enter image description here

umläute
  • 26,106
  • 8
  • 56
  • 114
chen abien
  • 147
  • 5
  • Does this answer your question? [Matplotlib overlapping annotations](https://stackoverflow.com/questions/8850142/matplotlib-overlapping-annotations) – RandomGuy Jul 13 '21 at 09:34

0 Answers0