To keep markers from being lightened or made more transparent according to their depth, pass depthshade=False to each Matplotlib 3D scatter call that needs consistent colors. The option is enabled by default in the current stable API.
Disable depth shading for consistent marker colors
depthshade is an option on Axes3D.scatter. It controls whether Matplotlib shades markers to give the appearance of depth. Set it to False when that visual effect interferes with comparing colors.
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(projection="3d")
ax.scatter(x, y, z, c="royalblue", depthshade=False)
plt.show()
This disables depth shading for that scatter collection; it does not change the supplied color itself. The official Axes3D.scatter API documents the default as True, following rcParams["axes3d.depthshade"].
Apply the setting to every scatter collection
Each call to scatter creates a collection with its own depth-shading choice. Set the argument on every group that should use consistent colors:
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →#1 Best Overall
ax.scatter(x1, y1, z1, c="royalblue", label="Group A", depthshade=False)
ax.scatter(x2, y2, z2, c="darkorange", label="Group B", depthshade=False)
Disabling it on one collection does not configure another collection.
What depth shading changes
With depth shading enabled, Matplotlib adjusts marker alpha according to projected point depths and sorts the colors to match depth ordering. As a result, markers using the same base color can look lighter or more transparent at different depths. The implementation is visible in the Matplotlib 3D axes source.
Rank #2
Keep shading but control its minimum opacity
If the depth cue is useful but distant points look too transparent, Matplotlib 3.11 and later provide depthshade_minalpha, which sets the minimum alpha used by shading. Its documented default is 0.3; the value can also be inherited from rcParams["axes3d.depthshade_minalpha"]. See the current scatter API reference for the version-specific parameter details. Choose depthshade=False instead if you want to remove the effect rather than adjust its opacity floor.
Check the color input if markers still differ
Turning off depth shading does not make different color inputs identical. The c argument can be a single color, a sequence of colors, RGB or RGBA rows, or values mapped through a colormap and normalization. If markers remain differently colored, inspect c and any cmap or norm arguments in the API documentation.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesVersion notes
The current stable reference is labeled Matplotlib 3.11.2: it supports depthshade=None to use the configured rcParams value and documents depthshade_minalpha as added in 3.11. Older official documentation, including the Matplotlib 3.2.0 reference, also lists depthshade with a default of True. Check the documentation for your installed version for exact defaults and available parameters.
Quick Recap
Best Value
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.




