1

Is there any way to decrease the density of data labels in Matplotlib? Right now, it looks like this. Link to screenshot of my plot

This is my code :

    countries_list.insert(0, "(0,0)")
    arrowprops = dict(arrowstyle='<-', color='blue', linewidth=1, mutation_scale=10)
    for i, txt in enumerate(countries_list):
        ax.annotate(string.capwords(txt), (x_list[i], y_list[i]), arrowprops = arrowprops)

Thanks.

Edit: I'm thinking more on the side of like is there maybe an automatic option to automatically rearrange the arrows the point to different locations around the plot to make the labels more readable?

1 Answers1

0

so I don't think there is really much you can do as far as adjusting the text size, since you would need to make it a tiny unreadable font to have each word be separate. I think what you are going to want to do is change the scale of your y axis. Right now you have a linear scale on your y axis with a very nonlinear distribution of your data, hence why you have a ton of data points squished near the bottom.

For your x axis set it with something like the following:

ax.set_yscale('log')

check out more about axes and scaling on their website: enter link description here

Also just found this, which will probably produce a much nicer looking plot than log scaling, especially since I dont know what kind of distribution we are looking at with your data.

enter link description here

You can use that to scale your y axis relative to your dataset and extreme values.

Brk1145
  • 46
  • 4
  • Yeah, I didn't think there could be anything I could do in regards to text size. I was thinking more on the side of maybe an automatic option to automatically rearrange the arrows the point to different locations around the plot to make the labels more readable. – sussssuuuuuuus Dec 18 '20 at 03:18