Closed
Description
Bug summary
It was supposed to rotate the xticklabes with clauses:
xticks = ax.get_xticks()
xticklabes = ax.get_ticklabels()
ax.set_xticks(xticks)
ax.set_xticklabels(xticklabels, rotation=90)
But it got empty xticklables as a result.
Code for reproduction
Snippet 1:
import matplotlib.pyplot as plt
import numpy as np
y = np.arange(10)
ax = plt.subplot()
ax.plot(y)
xticks = ax.get_xticks()
xticklabels = ax.get_xticklabels()
ax.set_xticks(xticks)
Snippet 2:
import matplotlib.pyplot as plt
import numpy as np
y = np.arange(10)
ax = plt.subplot()
ax.plot(y)
xticks = ax.get_xticks()
xticklabels = ax.get_xticklabels()
ax.set_xticks(xticks)
ax.set_xticklabels(xticklabes, rotation=90)
Actual outcome
As the result of Snippet 1, variable xticklabels
got correct result of current plot.
But when it came to Snippet 2, xticklabels
became empty []
. And plot show no xticklabes.
Expected outcome
Additional information
No response
Operating system
Windows 10
Matplotlib Version
3.5.2
Matplotlib Backend
No response
Python version
3.8.10
Jupyter version
3.0.6
Installation
pip