Skip to content Skip to sidebar Skip to footer

How To Rotate Axis Labels For Minor Ticks Within A Semilogx Plot?

Within the following code using matplotlib, I would like to rotate also the minor tick labels of the x axis. Unfortunately neither plt.setp(axes.xaxis.get_minorticklabels(), rotat

Solution 1:

You have to create the plot then update the properties of the minor tick labels.

So move the following code

for text in axes.get_xminorticklabels():
    print("text rotated")
    text.set_rotation(90)

below the plot creation code

axes.semilogx(t, sinus)

This is the order you must do things in:

  • create data
  • create plot
  • modify plot properties

Post a Comment for "How To Rotate Axis Labels For Minor Ticks Within A Semilogx Plot?"