DsCpp
DsCpp

Reputation: 2489

Matplotlib identify if xlabels "run" on each other

Using matplotlib I have multiple xlabels (which I cannot give up any)
After consulting this post I've decided to add a second line of xlabels for the spacing.
Unfortunately, while for some graphs it is enough, for some there are still too many labels, and I need a different solution.
My idea was to somehow "identify" that the xlabels run on each other - and if so, create a third line of xlabels, and so forth, Until no overlapping labels.
Can it be done?enter image description here

Edit:
It's not perferct, and doesn't answer directly the question of my post, but using rotation I got something reasonable I can work with
ax.set_xticklabels(labels, fontsize=8,rotation=20) enter image description here

Upvotes: 0

Views: 29

Answers (1)

Lamine Traore
Lamine Traore

Reputation: 33

What if you rotate the xticklabels by the settings within plot()?

Upvotes: 1

Related Questions