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 desk3 min

Create a Transparent 3D Scatter Plot in Python Matplotlib

Set alpha in Matplotlib’s 3D scatter plot for uniform transparency, use RGBA colors for per-point opacity, and disable depth shading when you need consistent appearance.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Use Matplotlib’s Axes3D.scatter() method and set alpha between 0 (fully transparent) and 1 (fully opaque). For consistent opacity across depths, also set depthshade=False; for different opacity per point, pass RGBA colors.

Make a 3D scatter plot with uniform transparency

Create a 3D axes, then pass equal-length arrays for the x, y, and z coordinates to ax.scatter(). This complete example uses generated data; replace the arrays with your own.

import matplotlib.pyplot as plt
import numpy as np

# Replace these arrays with your data. Each must have the same length.
rng = np.random.default_rng(7)
x = rng.normal(size=250)
y = rng.normal(size=250)
z = rng.normal(size=250)

fig = plt.figure(figsize=(8, 6))
ax = fig.add_subplot(projection="3d")

ax.scatter(
    x, y, z,
    s=36,
    color="royalblue",
    alpha=0.35,
    depthshade=False,
)

ax.set_xlabel("X")
ax.set_ylabel("Y")
ax.set_zlabel("Z")
ax.set_title("Transparent 3D scatter plot")
plt.tight_layout()
plt.show()

The key setting is alpha=0.35: lower values make markers more transparent. Adjust it to suit the density and contrast of your data. The official Matplotlib 3D scatter example uses the same basic workflow: create axes with projection="3d", call scatter with three coordinate arrays, and label the axes.

Set a different opacity for each point

Use an RGBA color array when transparency varies by point—for example, when opacity represents a measurement. Each row contains red, green, blue, and alpha components, with color components expressed from 0 to 1.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
rgba = np.zeros((len(x), 4))
rgba[:, 0] = 65 / 255       # red
rgba[:, 1] = 105 / 255      # green
rgba[:, 2] = 225 / 255      # blue
rgba[:, 3] = np.linspace(0.15, 0.8, len(x))

ax.scatter(x, y, z, c=rgba, depthshade=False)

Matplotlib accepts color arrays with RGB or RGBA rows. Use the single alpha argument when all markers should share opacity; use RGBA when opacity needs to vary point by point. See the Axes3D.scatter API reference for the color and scatter-property details.

Choose whether depth shading should be on

By default, Matplotlib’s 3D scatter applies depth shading according to the axes3d.depthshade setting, which the current stable documentation lists as true. Shading provides a visual depth cue, but it can make markers appear to have different opacity even when they share one alpha value.

  • Disable it for consistent-looking opacity: set depthshade=False, as in the uniform-opacity example.
  • Keep it for a depth cue: omit the argument or leave it enabled, understanding that marker appearance can vary with depth.

The setting applies independently to each scatter call. The official customization documentation describes the related mplot3d settings.

Troubleshoot visibility and overlap

Markers still look too solid

Lower alpha, such as changing 0.5 to 0.25. Very low opacity can make isolated points difficult to see, so choose a value that balances individual-point visibility with overlap.

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

Opacity seems to change with depth

Set depthshade=False if a consistent appearance matters more than the depth cue. Otherwise, retain shading and interpret apparent opacity differences cautiously.

Dense regions obscure one another

Transparency can reveal overlapping points, but a 3D chart is still displayed as a 2D projection, so it cannot eliminate occlusion. If the figure is interactive, rotate or zoom to inspect another view; Matplotlib’s mplot3d overview describes those capabilities. You can also split groups into separate scatter calls and style them differently.

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

Check compatibility for less-common options

The current stable Axes3D.scatter API reference identifies itself as Matplotlib 3.11.2. It documents depthshade_minalpha as added in version 3.11 and axlim_clip as added in version 3.10. They are not needed for the examples above; check the API documentation for your installed version before using them in code that must run on older Matplotlib releases.

Matplotlib’s mplot3d toolkit creates a 2D projection of a 3D scene. Its official overview describes it as providing simple 3D plotting capabilities, and notes that it is not the fastest or most feature-complete 3D library. For a straightforward transparent scatter plot, however, the built-in 3D axes and scatter method provide the required controls.

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.

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
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

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.