Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: What is the role of the `plt.xticks()` and `plt.yticks()` functions in Matplotlib?
Answer: `plt.xticks()` and `plt.yticks()` are used to customize the tick positions and labels on the x-axis and y-axis, respectively.

Example:

plt.plot([1, 2, 3, 4], [10, 20, 25, 30])
plt.xticks([1, 2, 3, 4], ['A', 'B', 'C', 'D'])
plt.show()
Is it helpful? Yes No

Most helpful rated by users:

©2026 WithoutBook