To remove a Matplotlib colorbar, keep the Colorbar object returned by fig.colorbar() or plt.colorbar(), then call cbar.remove(). To hide only selected colorbar labels, set the tick positions and corresponding labels together, using an empty string where you want a tick without text. For ordinary plot axes, use tick_params to hide labels while preserving ticks, or set a shorter list of tick positions to remove unwanted ticks as well.
Remove the entire colorbar
A Matplotlib colorbar is drawn in its own axes and maps values from a scalar mappable—such as an image—to colors. Save the object returned when you create it; that is the object to remove later.
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
image = ax.imshow(data)
cbar = fig.colorbar(image, ax=ax)
# Later, remove the colorbar:
cbar.remove()
The same approach applies when creating a colorbar with plt.colorbar(): retain its return value and call remove() on it. The Matplotlib 3.10.0 colorbar API documents Colorbar.remove(); when the colorbar was created with use_gridspec=True, removal restores the previous gridspec.
Hide selected colorbar labels but keep their ticks
Use Colorbar.set_ticks() to specify tick positions and labels as a pair. Put an empty string at a position whose tick should remain visible without a label:
Recommended Free Tools
#1 Best Overall
- 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
cbar.set_ticks([0, 1, 2, 3], labels=["0", "", "2", "3"])
Each label corresponds to the tick at the same index. This keeps the tick at 1 while hiding its text. The Matplotlib colorbar API discourages setting labels alone with set_ticklabels() in most cases, because labels can become mismatched if tick locations change. If you do use set_ticklabels(), fix the tick positions first.
Hide ordinary axis labels without removing ticks
For a plot’s x- or y-axis, tick_params() can hide labels independently of tick locations and marks:
Rank #2
- 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
# Keep x tick marks and locations, but hide the bottom labels
ax.tick_params(axis="x", labelbottom=False)
# Keep y tick marks and locations, but hide the left labels
ax.tick_params(axis="y", labelleft=False)
These options target the bottom and left sides. For a top or right axis, use labeltop=False or labelright=False, respectively. Tick marks can be controlled separately with options such as bottom=False or left=False. Properties not specified remain unchanged unless reset=True is used. See the Axes.tick_params reference.
Remove specific ordinary-axis ticks and their labels
If you want to retain only certain x-axis tick locations, provide just those positions and matching labels:
Rank #3
- 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.
ax.set_xticks([0, 2, 5], labels=["start", "middle", "end"])
Use ax.set_yticks() in the same way for the y-axis. Passing [] removes all ticks on that axis; for example, ax.set_xticks([]) removes every x tick and label. Setting explicit positions replaces the axis locator with a fixed locator, and Matplotlib may expand view limits so all supplied ticks are visible. If that is not wanted, set the desired limits after setting the ticks. The behavior is described in the Axes.set_xticks reference.
Choose the method that matches what should disappear
| What you want to change | Use | Effect |
|---|---|---|
| The whole colorbar | cbar.remove() |
Removes the colorbar from the figure. |
| Some colorbar text only | cbar.set_ticks(positions, labels=labels) |
Retains chosen tick locations, including any with an empty label. |
| Axis labels only | ax.tick_params(..., labelbottom=False) or labelleft=False |
Hides labels while keeping tick locations and marks. |
| Some ordinary-axis ticks and labels | ax.set_xticks() or ax.set_yticks() |
Retains only the specified locations and their corresponding labels. |
The colorbar methods apply to a Colorbar; the axis methods apply to an Axes. For plots whose tick positions are generated dynamically, avoid fixing a list of positions unless you intend to replace that behavior. If an API behaves differently in your installation, consult documentation for the Matplotlib version you use; the colorbar guidance here is from 3.10.0, while the stable axes references identify a 3.11.2 documentation build.
Quick Recap
Best Value
- 【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.
Rank #4
- 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
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.




