DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk3 min

Matplotlib Scatter Markers: Set Shape, Size, and Color

Control Matplotlib scatter markers with marker for shape, s for area in points squared, and c for fixed colors or colormapped values.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Matplotlib’s scatter() arguments marker, s, and c to control point shape, area, and color. For example, ax.scatter(x, y, marker="^", s=50, c="tab:blue") draws blue upward triangles. For point-by-point styling, pass arrays for size or color; use separate scatter calls when groups need different marker shapes.

Set one shape, size, and color

scatter() is the main interface for styling points. This example uses an upward triangle, a marker area of 50 points squared, and a fixed named color:

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.scatter(x, y, marker="^", s=50, c="tab:blue")
plt.show()

Replace x and y with sequences of matching data values. The scatter API reference documents the arguments and supported forms.

Choose a marker shape with marker

The marker argument sets the symbol used for points in that scatter call. Common shorthands include "o" for a circle, "s" for a square, "^" and "v" for upward and downward triangles, "D" for a diamond, and "*" for a star. See Matplotlib’s marker reference for the full catalog.

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

Set marker area with s

s is the marker area in points squared, not its diameter. It accepts one scalar for all points or an array-like sequence for individual points; if omitted, Matplotlib uses rcParams['lines.markersize'] ** 2. For instance:

sizes = [20, 60, 120]
ax.scatter(x, y, s=sizes)

When size represents a measurement, choose a visible range and explain what larger or smaller markers mean. The units and per-point size behavior are documented in the scatter API and illustrated in the scatter size example.

Set fixed colors or map values with c

Use one fixed color

Pass a color name or other supported color specification to apply one color to every point:

ax.scatter(x, y, c="tab:blue")

Give points individual colors

c can also be a sequence of colors, one per point. This is useful when colors are categories you have already assigned rather than values that need a continuous scale.

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

Map numeric values through a colormap

Pass numeric values as c and select a colormap with cmap. Matplotlib maps the values to colors using a normalization; vmin and vmax set the limits when using the default normalization:

values = [0.1, 0.5, 0.9]
points = ax.scatter(x, y, c=values, cmap="viridis", vmin=0, vmax=1)
fig.colorbar(points, ax=ax, label="Value")

A colorbar makes the numeric meaning of the colors readable. For more control over the mapping, use norm; vmin and vmax are intended for the default norm. Matplotlib’s API reference and colormap example show numeric color mapping and limits.

One color input can be ambiguous: a single numeric RGB or RGBA sequence may be interpreted as scalar values to colormap, rather than one literal color. Use a color string for a single named color, or a two-dimensional RGB(A) array when supplying explicit channel values.

Style outlines and transparency

Use edgecolors to set marker outlines, linewidths to set their width, and alpha to adjust transparency. Matplotlib ignores edgecolors for non-filled markers, so an outline setting will not affect those symbols. Check the marker type if changing the edge color appears to do nothing; this behavior is noted in the scatter API reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use different shapes for different groups

To distinguish groups by shape, make a separate scatter() call for each group and set a different marker in each call. A 2016 Matplotlib Discourse answer gives this approach as guidance; because that advice is historical rather than a current API guarantee, check behavior with the Matplotlib version used by your project. If the groups also share a numeric color scale, use the same colormap and normalization for each call so equivalent values retain equivalent colors. See the Discourse discussion.

Make the encodings interpretable

  • Use shape for a small number of categories that remain distinguishable at the final displayed size.
  • Use size to show relative magnitude, and state what the area represents.
  • Use a colorbar when color encodes numeric values; use a legend or clear labels when colors or shapes identify categories.
  • Check the plot at its intended output size: symbols that look distinct on screen may become hard to tell apart in a smaller figure.

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
Windows Errors? Fix Them Before They SpreadFree repair 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.