Python Matplotlib Multiple Pie Charts

Have you ever tried to compare different datasets side-by-side and realized a single chart just doesn’t cut it?

In my years working as a Python developer, I have often found that a Python Matplotlib multiple pie chart layout is the best way to visualize proportions across different categories.

Whether you are comparing regional sales or demographic shifts over the years, placing two or more pie charts in one figure makes your data story much more compelling.

In this tutorial, I will walk you through exactly how I build these Python visualizations from scratch.

Method 1: Create Multiple Pie Charts Using Python Subplots

The most reliable way I have found to create multiple charts is by using the plt.subplots() function in Python.

This method allows me to define a grid (like 1 row and 2 columns) and place a unique Python pie chart in each cell.

Example: Compare Smartphone Market Share in NY and FL

In this example, I will use Python code to compare how different smartphone brands perform in New York and Florida.

import matplotlib.pyplot as plt

# Data for New York
ny_labels = ['Apple', 'Samsung', 'Google', 'Others']
ny_sizes = [45, 30, 15, 10]

# Data for Florida
fl_labels = ['Apple', 'Samsung', 'Google', 'Others']
fl_sizes = [35, 40, 10, 15]

# Define the figure and a grid of 1 row and 2 columns
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 6))

# Plotting the first Python pie chart for New York
ax1.pie(ny_sizes, labels=ny_labels, autopct='%1.1f%%', startangle=140, colors=['#ff9999','#66b3ff','#99ff99','#ffcc99'])
ax1.set_title('Smartphone Market Share: New York')

# Plotting the second Python pie chart for Florida
ax2.pie(fl_sizes, labels=fl_labels, autopct='%1.1f%%', startangle=140, colors=['#ff9999','#66b3ff','#99ff99','#ffcc99'])
ax2.set_title('Smartphone Market Share: Florida')

# Display the Python visualization
plt.tight_layout()
plt.show()

You can see the output in the screenshot below.

Python Matplotlib Multiple Pie Charts

When I run this Python code, it generates two clean charts side-by-side. I always use plt.tight_layout() because it prevents the titles from overlapping, which is a common headache in Python plotting.

Method 2: Add the Explode Effect to Python Multiple Pie Charts

Sometimes, I want to highlight a specific slice of the data, like the “Apple” market share in our USA example.

The “explode” feature in Python Matplotlib allows me to pull a slice out of the center for emphasis.

Python Explode Method A: Explode a Single Slice in Multiple Charts

In this approach, I pass a tuple to the explode parameter in Python to shift only one specific segment.

import matplotlib.pyplot as plt

# USA Car Brand Preference Data
brands = ['Ford', 'Tesla', 'Chevrolet', 'Toyota']
midwest_usage = [40, 20, 25, 15]
westcoast_usage = [20, 45, 15, 20]

# Defining which slice to explode (Tesla is the second index)
# 0 means no movement, 0.1 means slight separation
my_explode = (0, 0.1, 0, 0) 

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 6))

# Midwest Chart with Python Explode
ax1.pie(midwest_usage, labels=brands, explode=my_explode, autopct='%1.1f%%', shadow=False)
ax1.set_title('Car Preferences: Midwest')

# West Coast Chart with Python Explode
ax2.pie(westcoast_usage, labels=brands, explode=my_explode, autopct='%1.1f%%', shadow=False)
ax2.set_title('Car Preferences: West Coast')

plt.show()

You can see the output in the screenshot below.

Matplotlib Multiple Pie Charts

I find that an exploded value of 0.1 is usually enough to catch the eye without making the Python chart look disconnected.

Python Explode Method B: Explode All Slices for a “Fragmented” Look

If I want to show that all categories are distinct and separate, I apply an explode value to every slice in the Python array.

import matplotlib.pyplot as plt

# Data for US Energy Sources
sources = ['Solar', 'Wind', 'Hydro', 'Fossil']
data_2020 = [10, 20, 10, 60]
data_2023 = [20, 30, 10, 40]

# Explode every slice by 0.05
full_explode = (0.05, 0.05, 0.05, 0.05)

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 6))

ax1.pie(data_2020, labels=sources, explode=full_explode, autopct='%1.1f%%')
ax1.set_title('US Energy Mix 2020')

ax2.pie(data_2023, labels=sources, explode=full_explode, autopct='%1.1f%%')
ax2.set_title('US Energy Mix 2023')

plt.show()

This Python technique creates a modern “exploded” view that looks great in business presentations.

Method 3: Enhance Python Multiple Pie Charts with Shadows

Adding a shadow is my favorite way to give a Python chart a 3D feel and make it pop off the white background.

In Matplotlib, this is as simple as setting the shadow parameter to True.

Python Shadow Method A: Basic Boolean Shadowing

This is the quickest way I add depth to my Python visualizations.

import matplotlib.pyplot as plt

# USA Fast Food Popularity
labels = ['Burgers', 'Pizza', 'Tacos', 'Salads']
east_coast = [40, 35, 15, 10]
west_coast = [30, 30, 30, 10]

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 6))

# Enable shadow for a professional look
ax1.pie(east_coast, labels=labels, autopct='%1.1f%%', shadow=True)
ax1.set_title('Fast Food: East Coast')

ax2.pie(west_coast, labels=labels, autopct='%1.1f%%', shadow=True)
ax2.set_title('Fast Food: West Coast')

plt.show()

You can see the output in the screenshot below.

Multiple Pie Charts in Matplotlib

I noticed that shadows work best when the chart colors are vibrant, as it creates a nice contrast.

Python Shadow Method B: Combine Shadow with Explode

When I want to create a truly premium visualization, I combine the shadow and explode effects in Python.

This makes the “exploded” slice look like it is floating above the rest of the Python pie chart.

import matplotlib.pyplot as plt

# US Streaming Service Market Share
services = ['Netflix', 'Disney+', 'Hulu', 'Amazon Prime']
q1_data = [35, 25, 20, 20]
q4_data = [30, 30, 20, 20]

# Explode the first slice (Netflix)
impact_explode = (0.1, 0, 0, 0)

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 6))

ax1.pie(q1_data, labels=services, explode=impact_explode, shadow=True, autopct='%1.1f%%')
ax1.set_title('Streaming Share Q1')

ax2.pie(q4_data, labels=services, explode=impact_explode, shadow=True, autopct='%1.1f%%')
ax2.set_title('Streaming Share Q4')

plt.show()

In my experience, this combination is the “gold standard” for making Python pie charts look high-end.

Tips for Better Python Pie Charts

Over the years, I have learned a few tricks that make these Python charts much more readable for users in the USA.

First, always start your Python pie chart at a consistent angle (like startangle=90 or 140). This ensures that if you have two charts, the slices begin at the same point, making comparison much easier.

Second, I recommend using a legend if your Python labels are long, as they can clutter the space between the two charts. You can add a legend in Python using plt.legend(), but I usually find that putting labels directly on the slices is more intuitive.

Lastly, pay attention to your Python color palette. I often use hex codes to match brand guidelines for US-based clients.

In this tutorial, I showed you how to create multiple pie charts using Python and Matplotlib. I also covered how to use the explode effect to highlight data and how to add shadows for a 3D appearance.

You may read:

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.