October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Customize Matplotlib Tick Params Font Size and Color

Use ax.tick_params with labelsize and labelcolor to change Matplotlib tick label size and color, then narrow the scope with axis and which or set defaults with rcParams.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To change tick label font size and color on an existing Axes, call ax.tick_params(axis='both', labelsize=12, labelcolor='navy'). That one call sets the size and text color of both axes’ tick labels. The rest of this guide covers how to narrow the change to one axis or to minor ticks, how to set the same styling as a default for every plot, and why styling occasionally disappears after a figure is redrawn.

Set tick label size and color on one Axes

The method is Axes.tick_params. It accepts keyword arguments that control the tick marks and the tick labels, and it only affects the Axes you call it on. The example below assumes you already have a figure and an Axes named ax:

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.plot([1, 2, 3], [2, 4, 3])
ax.tick_params(axis='both', labelsize=12, labelcolor='navy')
plt.show()

Three keywords do most of the work:

Keyword What it changes Example value
labelsize Font size of tick labels, given in points or as a named size such as 'large' labelsize=12
labelcolor Text color of tick labels only; tick marks keep their color labelcolor='navy'
colors Tick marks and tick labels together, using one shared color colors='navy'

Use colors when you want the tick marks and labels to match. Use labelcolor when the labels should differ from the marks. Passing both in one call is allowed, but the more specific labelcolor is the one you will see on the labels, so avoid passing both unless you have checked the result.

Limit the change to one axis or tick class

Two keywords narrow the scope. axis selects the x-axis ('x'), the y-axis ('y'), or both ('both', the default). which selects major ticks ('major', the default), minor ticks ('minor'), or both classes ('both').

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#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
ax.tick_params(axis='x', which='major', labelsize=10, labelcolor='darkgreen')
ax.tick_params(axis='y', which='minor', labelsize=8, labelcolor='gray')

The first line changes only the x-axis major labels. The second changes only the y-axis minor labels. If your minor ticks appear unchanged, the most common cause is that the call did not include which='minor' or which='both'; minor ticks exist only when the Axes has them enabled, for example through a minor locator.

Any property you do not pass keeps its existing value. A later call therefore layers on top of earlier styling. If you want to clear previous tick settings for that Axes before applying new ones, pass reset=True together with the properties you want.

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 for the current Axes

If you are working in a script that uses pyplot’s state-based interface, plt.tick_params(...) is the equivalent call. It takes the same keyword arguments and applies them to the current Axes:

plt.tick_params(axis='x', labelsize=10, labelcolor='darkgreen')

In an object-oriented script with several subplots, prefer ax.tick_params, because the pyplot wrapper always targets whichever Axes is current, which is easy to get wrong when there are several.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Set the same styling as a default for every plot

When you want the same tick label styling on every figure in a project, set the defaults through rcParams instead of repeating the call. Matplotlib exposes separate keys for the x and y tick groups:

import matplotlib as mpl

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

Grouped settings through matplotlib.rc are another supported way to apply the same values. Choose between the two approaches by how far the change should reach:

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
  • One figure or one Axes: use ax.tick_params. It is explicit and easy to find in the code that produces the plot.
  • Every figure in a script or project: set rcParams once near the top of the script or in a shared style setup. Defaults apply to figures created after the change.
  • Return to stock behavior: call matplotlib.rcdefaults(), or select the default style, to restore the built-in values.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why tick label styling sometimes disappears

Matplotlib tick and tick-label objects are not permanent. Plotting calls, panning, zooming, and other changes can create, delete, or rebuild them. Styling you applied to a specific label object may then be lost, even though the code ran without an error.

Two practices cause most of these problems:

  • Editing current tick-label objects directly. Changes made to objects returned from the current tick list may not survive a redraw. Use tick_params instead, because it describes the styling rather than attaching it to a single object.
  • Using set_ticklabels to restyle labels. Matplotlib discourages this unless the tick positions are fixed first. When you need custom label text at fixed positions, set the positions and the labels together, for example ax.set_xticks([0, 1, 2], ['low', 'mid', 'high']), and then apply tick_params for the size and color.

Use xticks from pyplot to set positions and labels, not to style them. Styling belongs in tick_params or rcParams.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Troubleshooting checklist

  • Labels changed back after zooming or a later plot call: move the tick_params call after the last plotting call on that Axes, or switch from direct label edits to tick_params.
  • Only one axis changed: check axis=. The default is 'both', so a call that sets axis='x' leaves the y-axis alone.
  • Minor ticks look unchanged: add which='minor' or which='both', and confirm the Axes actually has minor ticks.
  • A plot ignores your rcParams change: set the defaults before creating the figure. Existing figures keep the settings they were built with.
  • A keyword is rejected: confirm your version. The parameter names above match the Matplotlib pyplot reference current at the time of writing, which lists version 3.11.2. Run import matplotlib; print(matplotlib.__version__) to check your installed release, and consult the Axes.tick_params reference for that version if it differs.

In short, use ax.tick_params with labelsize and labelcolor for individual plots, add axis and which to narrow the scope, and use rcParams only when the same styling should apply everywhere.

“””

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.