Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober 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 desk2 min

How to Set Matplotlib Scatter Markers Across Multiple Plots

Use marker on each scatter call for different shapes, or set scatter.marker for a shared default. Learn when rc_context helps and how scatter sizing differs from plot markersize.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Pass marker to each Axes.scatter() call when plots need different shapes. To give plots a shared default, set Matplotlib’s scatter.marker rcParam; use rc_context when that default should apply only temporarily.

Give each scatter plot its own marker

Set marker on each axes’ scatter() call. For example, this creates two side-by-side plots with a circle and an upward triangle:

As an Amazon Associate I earn from qualifying purchases.

import matplotlib.pyplot as plt

fig, (ax1, ax2) = plt.subplots(1, 2)
ax1.scatter(x1, y1, marker="o", s=36, label="Group A")
ax2.scatter(x2, y2, marker="^", s=36, label="Group B")

Here x1, y1, x2, and y2 stand for your data arrays. The marker argument accepts a text shorthand or a MarkerStyle instance, as described in the Axes.scatter API. Common shorthands include o for circle, s for square, ^ for upward triangle, D for diamond, and * for star. See the marker reference examples for more options.

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

Set a shared default for multiple plots

If scatter calls should use the same marker unless a call specifies otherwise, set scatter.marker. Matplotlib lists it as the default scatter marker in its configuration reference.

Limit the default to a block of code

Use mpl.rc_context to apply a temporary setting. Once the block ends, the prior runtime configuration is restored.

import matplotlib as mpl
import matplotlib.pyplot as plt

with mpl.rc_context({"scatter.marker": "s"}):
    fig, (ax1, ax2) = plt.subplots(1, 2)
    ax1.scatter(x1, y1)
    ax2.scatter(x2, y2)

Both scatter calls use squares here because neither supplies its own marker. A per-call marker is the right choice when one plot should differ from the shared default. Matplotlib also supports style sheets and matplotlibrc for reusable configuration; its documented precedence is runtime rc settings, then style sheets, then matplotlibrc. See the customization guide.

Size scatter markers with the right parameter

Use s in scatter() to set marker size. Its values are approximately proportional to visual area, so they are not directly interchangeable with markersize in plot(), which is generally specified as marker width or diameter in points. Copying the same number between the two functions will not necessarily produce markers with the same visible dimensions. Matplotlib explains the distinction in its quick start guide.

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

s can be a scalar for a uniform size or array-like when points need different sizes. For scatter examples combining size and color, see Matplotlib’s scatter plot example.

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

Choose shape alongside other visual encodings

Marker shape is one way to distinguish groups, but scatter plots also support face color, edge color, transparency, size, and color mapping. Use shapes and colors consistently, and label groups when that makes the plot easier to interpret. The scatter API documents these styling arguments.

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 *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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
Crashes, No Sound, or Screen Glitches?Free driver scan
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.