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.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitches#1 Best Overall
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.
Rank #2
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.
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.
Best Value
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.
Quick Recap
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.




