Matplotlib Subplot Titles – Change Font Size and Bold Text

I was working on a Python project where I needed multiple subplots to compare data across different U.S. states.

The charts looked fine, but the subplot titles were too small and hard to read. Some of them also needed to stand out in bold text. If you’ve ever struggled with customizing subplot titles in Matplotlib, you’re not alone. By default, the titles are not very eye-catching.

So in this tutorial, I’ll show you two simple ways to change the subplot title font size and make it bold.

Change Font Size of Subplot Titles in Python

When you create multiple subplots in Matplotlib, the default title font size is often too small. Here are two methods I use to increase or decrease the font size of subplot titles in Python.

Method 1 – Use Python’s fontsize Parameter in set_title()

The most direct way to change the font size of subplot titles in Python is by using the fontsize parameter inside the set_title() function.

This method is quick and easy when you want to control the title size directly.

import matplotlib.pyplot as plt

# Sample data for U.S. states
states = ["California", "Texas", "New York", "Florida"]
values = [400, 350, 300, 280]

fig, axs = plt.subplots(2, 2, figsize=(10, 6))

# Plotting data in subplots
axs[0, 0].bar(states, values)
axs[0, 0].set_title("State Population", fontsize=16)

axs[0, 1].plot(values, marker='o')
axs[0, 1].set_title("Growth Trend", fontsize=18)

axs[1, 0].pie(values, labels=states)
axs[1, 0].set_title("Population Share", fontsize=14)

axs[1, 1].scatter(range(len(states)), values)
axs[1, 1].set_title("Scatter View", fontsize=20)

plt.tight_layout()
plt.show()

You can see the output in the screenshot below.

Matplotlib Subplot Titles Change Font Size

In this example, I used different font sizes (14, 16, 18, 20) for each subplot title. This makes the chart much easier to read, especially when presenting to clients or in meetings.

Method 2 – Use rcParams to Set Global Font Size

Sometimes, I want all subplot titles in Python to have the same font size. Instead of setting it manually for each subplot, I use rcParams.

This method is useful when working with large dashboards or multiple charts.

import matplotlib.pyplot as plt

# Set global font size for all subplot titles
plt.rcParams['axes.titlesize'] = 18

states = ["California", "Texas", "New York", "Florida"]
values = [400, 350, 300, 280]

fig, axs = plt.subplots(2, 2, figsize=(10, 6))

axs[0, 0].bar(states, values)
axs[0, 0].set_title("State Population")

axs[0, 1].plot(values, marker='o')
axs[0, 1].set_title("Growth Trend")

axs[1, 0].pie(values, labels=states)
axs[1, 0].set_title("Population Share")

axs[1, 1].scatter(range(len(states)), values)
axs[1, 1].set_title("Scatter View")

plt.tight_layout()
plt.show()

You can see the output in the screenshot below.

Subplot Titles in Matplotlib Change Font Size

Here, I set plt.rcParams[‘axes.titlesize’] = 18. This automatically applies the font size to all subplot titles, saving time and keeping the design consistent.

Make Subplot Titles Bold in Python

Apart from font size, sometimes I want subplot titles to stand out by making them bold. Here are two ways to make subplot titles bold in Matplotlib using Python.

Method 1 – Use fontweight=’bold’ in set_title() in Python

The simplest way to make subplot titles bold is to use the fontweight parameter. This method is straightforward and gives you full control over each subplot title.

import matplotlib.pyplot as plt

states = ["California", "Texas", "New York", "Florida"]
values = [400, 350, 300, 280]

fig, axs = plt.subplots(2, 2, figsize=(10, 6))

axs[0, 0].bar(states, values)
axs[0, 0].set_title("State Population", fontweight='bold')

axs[0, 1].plot(values, marker='o')
axs[0, 1].set_title("Growth Trend", fontweight='bold')

axs[1, 0].pie(values, labels=states)
axs[1, 0].set_title("Population Share", fontweight='bold')

axs[1, 1].scatter(range(len(states)), values)
axs[1, 1].set_title("Scatter View", fontweight='bold')

plt.tight_layout()
plt.show()

You can see the output in the screenshot below.

Matplotlib Subplot Titles Bold Text

Here, each subplot title is now bold, making the visualization more professional and easier to present.

Method 2 – Use rcParams to Apply Bold Globally

If I want all subplot titles to be bold without repeating fontweight=’bold’ for each one, I use rcParams.

This method is efficient when preparing reports with multiple charts.

import matplotlib.pyplot as plt

# Apply bold globally to all subplot titles
plt.rcParams['axes.titleweight'] = 'bold'

states = ["California", "Texas", "New York", "Florida"]
values = [400, 350, 300, 280]

fig, axs = plt.subplots(2, 2, figsize=(10, 6))

axs[0, 0].bar(states, values)
axs[0, 0].set_title("State Population")

axs[0, 1].plot(values, marker='o')
axs[0, 1].set_title("Growth Trend")

axs[1, 0].pie(values, labels=states)
axs[1, 0].set_title("Population Share")

axs[1, 1].scatter(range(len(states)), values)
axs[1, 1].set_title("Scatter View")

plt.tight_layout()
plt.show()

You can see the output in the screenshot below.

Subplot Titles in Matplotlib Bold Text

With this approach, all subplot titles become bold automatically. This is especially helpful when preparing polished reports for business or academic use.

Conclusion

Customizing subplot titles in Python’s Matplotlib is simple once you know the right methods.

I showed you two ways to change font size (fontsize parameter and rcParams) and two ways to make titles bold (fontweight parameter and rcParams). Both approaches work well, and you can choose the one that best fits your project.

Personally, I use the direct set_title() method when working on small charts and rcParams when I need consistency across multiple subplots.

You may like to 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.