Long category names overlap on the x-axis. Which call rotates the tick labels by 45 degrees?
-
A
plt.xlim(45)
-
B
plt.xlabel(rotate=45)
-
C
plt.rotate_x(45)
-
D
plt.xticks(rotation=45)
Correct answer
Correct answer
D. plt.xticks(rotation=45)
16 views
Explanation
plt.xticks(rotation=45), often with ha='right' and plt.tight_layout(), keeps long labels readable on bar charts.
Reference
Asked in: Data Science Interviews
Doubts & discussion
Not sure why the answer is D? Ask here and get an explanation.
Ask a doubt about this MCQ