Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To change the font size and color of tick labels on an existing Matplotlib Axes, call ax.tick_params() with labelsize and labelcolor. For example, ax.tick_params(axis='both', labelsize=12, labelcolor='navy') sets both axes’ tick labels to 12 points in navy. The same method also covers tick marks, minor ticks, and default styling for every plot you make later.

Set font size and color on an existing Axes

Most tick styling is done on an Axes object, the plotting area that holds the lines, bars, and axis ticks. Pass the properties you want to change to tick_params, and Matplotlib updates only those properties. Everything else keeps its current value.

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.plot([1, 2, 3], [4, 1, 9])

ax.tick_params(axis='both', labelsize=12, labelcolor='navy')
plt.show()

The two properties do different jobs:

Argument What it changes Accepted values Example
labelsize Font size of the tick labels A number in points, or a named size such as 'small', 'medium', or 'large' labelsize=10 or labelsize='large'
labelcolor Text color of the tick labels only Any Matplotlib color: a name, a hex string, or an RGB tuple labelcolor='darkgreen'
colors Tick marks and tick labels together Any Matplotlib color colors='navy'

Use labelcolor when you want readable text in one color while keeping the tick marks in their default color. Use colors when a single shade should apply to the whole axis, including the small tick lines.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Limit the change to one axis or to minor ticks

tick_params has two selector arguments. Leaving them out applies the change to every axis and only to major ticks, so it is worth setting them explicitly when you want a narrower effect.

#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
  • axis selects which axis is affected. The default is 'both'; use 'x' or 'y' for one axis.
  • which selects the tick class. The default is 'major'; use 'minor' for minor ticks or 'both' for both classes.

To make only the x-axis major tick labels smaller and green:

ax.tick_params(axis='x', which='major', labelsize=10, labelcolor='darkgreen')

Minor tick labels are often hidden by default, so changing their size or color has no visible effect until minor ticks are turned on, for example with ax.minorticks_on(). If a change does not appear, check the which value first.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Use the pyplot wrapper

If you work with the pyplot state-based interface and do not keep a reference to the Axes, plt.tick_params() accepts the same arguments and applies them to the current Axes. It is convenient in short scripts. In code with several subplots, an explicit ax.tick_params() call is clearer, because it is obvious which Axes is changed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import matplotlib.pyplot as plt

plt.plot([1, 2, 3], [4, 1, 9])
plt.tick_params(axis='y', labelsize=11, labelcolor='firebrick')

Set the same style as a default for future plots

If every chart in a project should use the same tick font size and color, set the defaults in rcParams instead of repeating tick_params calls. The relevant keys are xtick.labelsize, xtick.labelcolor, ytick.labelsize, and ytick.labelcolor.

Rank #3
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.
import matplotlib as mpl

mpl.rcParams.update({
    'xtick.labelsize': 12,
    'xtick.labelcolor': 'navy',
    'ytick.labelsize': 12,
    'ytick.labelcolor': 'navy',
})

The grouped rc function does the same thing in one line:

import matplotlib as mpl

mpl.rc('xtick', labelsize=12, labelcolor='navy')
mpl.rc('ytick', labelsize=12, labelcolor='navy')

Defaults apply to figures created after the setting is made. Figures that already exist keep their current styling, so set the defaults at the top of the script or in a style file. To undo your changes, call matplotlib.rcdefaults(), or select the built-in default style with plt.style.use('default').

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Why ticks are not safe to edit directly

A common alternative is to loop over ax.get_xticklabels() and set fontsize or color on each label object. This often works at first, but Matplotlib tick and label objects are not permanent. Plotting more data, panning, zooming, or other operations can create, delete, or rebuild them, and the direct changes can disappear. Matplotlib’s documentation describes this behavior, and it is the reason tick_params is the recommended route for ordinary styling.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The same caution applies to set_ticklabels(). It is discouraged unless the tick positions have already been fixed. When you need custom text at specific positions, set the positions and the labels in one call:

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
ax.set_xticks([0, 1, 2], labels=['Low', 'Medium', 'High'])
ax.tick_params(axis='x', labelsize=12, labelcolor='navy')

Set the positions and labels first, then style them with tick_params. This keeps the text attached to the correct ticks even if the plot is redrawn.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose the right approach

Approach Scope Can select x/y and major/minor? Survives later plotting or zooming? Best use
ax.tick_params() One Axes Yes Yes, for the properties you set Styling a specific chart
plt.tick_params() Current Axes Yes Yes, for the properties you set Short pyplot scripts
rcParams or rc All figures created afterward Only through the x/y tick groups Applies at creation time Project-wide or team-wide defaults
Editing label objects directly Objects present at that moment Manually Not reliably Avoid for ordinary styling

Troubleshooting when the change does not appear

  • The styled Axes is not the one you are viewing. In multi-panel figures, confirm that the variable you styled is the same ax you plotted on.
  • A later call reset the styling. Code that redraws the axis, such as a new set_xticks() call or a plotting function that rebuilds the ticks, can overwrite earlier changes. Move the tick_params call to after the last plotting or tick-setting call.
  • The wrong tick class was targeted. Minor tick labels need which='minor' or which='both', and minor ticks must be enabled first.
  • An rcParams change had no effect. Defaults only apply to figures created after the change. Set them before calling plt.subplots(), or pass the styling explicitly with tick_params.
  • The behavior differs from the documentation you are reading. Check your installed version with python -c "import matplotlib; print(matplotlib.__version__)". The pyplot reference current at the time of writing lists Matplotlib 3.11.2, and older releases may differ in small details.

Using the same tick_params call across Matplotlib releases is the most dependable approach, since its arguments have been stable across versions. Confirm the exact behavior against the reference for your installed release if you rely on an edge case.

Use ax.tick_params() for a single chart, rcParams for defaults across a project, and avoid editing tick-label objects directly. That combination covers almost every case where you need to change tick font size and color.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.