Quantcast
Channel: Aligning rotated xticklabels with their respective xticks - Stack Overflow
Viewing all articles
Browse latest Browse all 7

Aligning rotated xticklabels with their respective xticks

$
0
0

Check the x axis of the figure below. How can I move the labels a bit to the left so that they align with their respective ticks?

I'm rotating the labels using:

ax.set_xticks(xlabels_positions)ax.set_xticklabels(xlabels, rotation=45)

But, as you can see, the rotation is centered on the middle of the text labels. Which makes it look like they are shifted to the right.

I've tried using this instead:

ax.set_xticklabels(xlabels, rotation=45, rotation_mode="anchor")

... but it doesn't do what I wished for. And "anchor" seems to be the only value allowed for the rotation_mode parameter.

Example


Viewing all articles
Browse latest Browse all 7

Trending Articles