Home > Software design >  Rotate X labels are not fitted in the figure area
Rotate X labels are not fitted in the figure area

Time:06-26

I use the following code to create a box plot and then rotate the X labels. As you can see, the X labels are not completely in the figure area. How can I fix that?

plt.figure(figsize=(8, 4))
df.boxplot()
plt.xticks(rotation=45,ha='right', rotation_mode="anchor")
plt.show()

enter image description here

CodePudding user response:

Try:

plt.tight_layout()

or

plt.subplots_adjust(bottom=0.15)
  • Related