Customize Matplotlib Scatter Markers in Multiple Plots

I was working on a Python data visualization project where I needed to compare multiple datasets side by side using Matplotlib scatter plots.

The challenge was to make each scatter plot look distinct, with different marker styles, colors, and sizes, while maintaining a consistent and visually appealing layout.

In this tutorial, I’ll show you exactly how I did it. I’ll walk you through multiple Python-based methods to customize scatter markers in multiple Matplotlib plots.

By the end of this tutorial, you’ll be able to create professional, multi-panel scatter plots that clearly communicate your data story.

What is a Scatter Plot in Python?

A scatter plot in Python’s Matplotlib library is a simple yet powerful way to visualize the relationship between two variables.

Each point on the plot represents a data observation, and by customizing the marker style, color, and size, you can effectively highlight trends, clusters, or outliers.

Method 1 – Create Multiple Scatter Plots Using plt.subplot()

The simplest way to create multiple scatter plots in Python Matplotlib is by using the subplot() function. This method is great when you want to display multiple scatter plots in a single figure, arranged in a grid layout.

Let me show you how I do it.

Python Example: Multiple Scatter Plots with Different Markers

import matplotlib.pyplot as plt
import numpy as np

# Sample data for three U.S. regions
np.random.seed(10)
x1, y1 = np.random.rand(20), np.random.rand(20)
x2, y2 = np.random.rand(20), np.random.rand(20)
x3, y3 = np.random.rand(20), np.random.rand(20)

plt.figure(figsize=(12, 4))

# First scatter plot
plt.subplot(1, 3, 1)
plt.scatter(x1, y1, color='blue', marker='o', s=80, edgecolor='black')
plt.title('East Coast Data')
plt.xlabel('Income Level')
plt.ylabel('Housing Cost')

# Second scatter plot
plt.subplot(1, 3, 2)
plt.scatter(x2, y2, color='green', marker='^', s=100, edgecolor='black')
plt.title('Midwest Data')
plt.xlabel('Income Level')
plt.ylabel('Housing Cost')

# Third scatter plot
plt.subplot(1, 3, 3)
plt.scatter(x3, y3, color='red', marker='s', s=120, edgecolor='black')
plt.title('West Coast Data')
plt.xlabel('Income Level')
plt.ylabel('Housing Cost')

plt.tight_layout()
plt.show()

You can see the output in the screenshot below.

Customize Matplotlib Scatter Markers Multiple Plots

In this example, I’ve created three scatter plots side by side using different markers (o, ^, and s) to represent each U.S. region.

The subplot() function makes it easy to control the layout and maintain a consistent style across all plots.

Method 2 – Use plt.subplots() for Cleaner Code and Shared Axes

When dealing with multiple plots, I prefer using plt.subplots() because it gives me more flexibility and cleaner code.

It also allows me to share axes between plots, which is especially useful when comparing datasets with the same scale.

Here’s how you can do it in Python.

Python Example: Use plt.subplots() to Create Multiple Scatter Plots

import matplotlib.pyplot as plt
import numpy as np

# Generate random data
np.random.seed(20)
data = {
    'New York': (np.random.rand(15), np.random.rand(15)),
    'Chicago': (np.random.rand(15), np.random.rand(15)),
    'Los Angeles': (np.random.rand(15), np.random.rand(15))
}

fig, axes = plt.subplots(1, 3, figsize=(12, 4), sharey=True)

markers = ['o', 's', '^']
colors = ['#1f77b4', '#2ca02c', '#d62728']

for ax, (city, (x, y)), marker, color in zip(axes, data.items(), markers, colors):
    ax.scatter(x, y, color=color, marker=marker, s=100, edgecolor='black')
    ax.set_title(f"{city} Data")
    ax.set_xlabel('Average Income')
    ax.set_ylabel('Rent Cost')

plt.tight_layout()
plt.show()

You can see the output in the screenshot below.

Matplotlib Customize Scatter Markers in Multiple Plots

Here, each subplot represents a different U.S. city, with distinct marker shapes and colors. The sharey=True parameter ensures all plots share the same Y-axis, which makes the comparison between cities much easier.

Method 3 – Customize Marker Styles and Sizes Dynamically

Sometimes, you might want to dynamically change marker size or color based on another variable, like population or sales volume. This can make your scatter plots more informative and visually engaging.

Let’s look at how to do that in Python.

Python Example: Dynamic Marker Size and Color

import matplotlib.pyplot as plt
import numpy as np

# Simulated dataset for three product categories
np.random.seed(30)
categories = ['Electronics', 'Furniture', 'Groceries']
colors = ['#ff7f0e', '#1f77b4', '#2ca02c']

plt.figure(figsize=(10, 5))

for i, category in enumerate(categories):
    x = np.random.rand(20) * 100  # Sales Volume
    y = np.random.rand(20) * 50   # Profit Margin
    size = np.random.rand(20) * 500  # Marker size based on revenue
    plt.scatter(x, y, s=size, color=colors[i], alpha=0.6, label=category, edgecolor='black')

plt.title('Sales Performance by Product Category (USA)')
plt.xlabel('Sales Volume (in thousands)')
plt.ylabel('Profit Margin (%)')
plt.legend()
plt.grid(True)
plt.show()

You can see the output in the screenshot below.

Scatter Markers to Multiple Plots Matplotlib

In this Python example, the marker size corresponds to the revenue for each product category. This approach helps you visualize which categories contribute the most to total revenue at a glance.

Method 4 – Combine Multiple Scatter Plots Using plt.figure() and add_subplot()

If you want even more control over figure size, layout, or specific subplot positioning, you can use add_subplot() directly.

This method is useful when building dashboards or custom visualizations with varying plot sizes.

Python Example: Use add_subplot() for Custom Layout

import matplotlib.pyplot as plt
import numpy as np

# Random data for demonstration
np.random.seed(42)
x = np.linspace(0, 10, 30)
y1, y2, y3 = np.sin(x), np.cos(x), np.sin(x) + np.cos(x)

fig = plt.figure(figsize=(10, 6))

# Adding subplots manually
ax1 = fig.add_subplot(2, 2, 1)
ax1.scatter(x, y1, color='blue', marker='o', s=80)
ax1.set_title('Sine Function')

ax2 = fig.add_subplot(2, 2, 2)
ax2.scatter(x, y2, color='green', marker='^', s=80)
ax2.set_title('Cosine Function')

ax3 = fig.add_subplot(2, 2, (3, 4))
ax3.scatter(x, y3, color='red', marker='s', s=100)
ax3.set_title('Sine + Cosine')
ax3.set_xlabel('X-axis')
ax3.set_ylabel('Y-axis')

plt.tight_layout()
plt.show()

Here, I’ve created a custom 2×2 layout where the third plot spans two columns. This level of flexibility is one of the reasons I love using Matplotlib for professional Python data visualization work.

Tips for Better Scatter Plot Design in Python

  • Use consistent color schemes for easy comparison.
  • Add grid lines to help viewers interpret data points quickly.
  • Label your axes and titles clearly to make your plots self-explanatory.
  • Avoid clutter — too many points or overlapping markers can make your plot confusing.
  • Use transparency (alpha) to make overlapping points visible.

Creating multiple scatter plots in Python Matplotlib is easier than most people think, especially once you understand how to use subplot(), subplots(), and add_subplot().

Each method has its strengths:

  • subplot() is quick for simple layouts.
  • subplots() is perfect for structured, reusable code.
  • add_subplot() gives you total control of custom dashboards.

By customizing markers, colors, and sizes, you can make your multiple scatter plots not only informative but also visually appealing.

I hope you found this Python tutorial helpful. If you have any questions or suggestions, feel free to leave a comment below. I’d love to hear how you’re using Matplotlib scatter markers in your own projects.

You may also read:

Leave a Comment

51 Python Programs

51 PYTHON PROGRAMS PDF FREE

Download a FREE PDF (112 Pages) Containing 51 Useful Python Programs.

pyython developer roadmap

Aspiring to be a Python developer?

Download a FREE PDF on how to become a Python developer.

Let’s be friends

Be the first to know about sales and special discounts.