VOOZH about

URL: https://www.geeksforgeeks.org/python/matplotlib-axes-axes-set_xticklabels-in-python/

⇱ Matplotlib.axes.Axes.set_xticklabels() in Python - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Matplotlib.axes.Axes.set_xticklabels() in Python

Last Updated : 12 Jul, 2025

Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute.

matplotlib.axes.Axes.set_xticklabels() Function

The Axes.set_xticklabels() function in axes module of matplotlib library is used to Set the x-tick labels with list of string labels.

Syntax: Axes.set_xticklabels(self, labels, fontdict=None, minor=False, **kwargs) 

Parameters: This method accepts the following parameters.

  • labels : This parameter is the list of string labels.
  • fontdict : This parameter is the dictionary controlling the appearance of the ticklabels.
  • minor : This parameter is used whether set major ticks or to set minor ticks

Return value: This method returns a list of Text instances.

Below examples illustrate the matplotlib.axes.Axes.set_xticklabels() function in matplotlib.axes: 

Example 1: 

Output:

 👁 Image
 

Example 2: 

Output:

 👁 Image

Comment
Article Tags: