I often work with Python visualizations where multiple subplots are involved. I’ve realized that the way subplot titles are styled makes a huge difference in readability. I used the default settings for subplot titles in Matplotlib. But soon I noticed that the titles often overlapped with the plots or didn’t look aligned properly.
That’s when I explored how to change the subplot title position and adjust the padding in Python’s Matplotlib. These two small customizations made my charts look much more professional.
In this tutorial, I’ll walk you through simple methods to change the subplot title style in Python. I’ll show you how to move the title position and how to adjust its padding with easy-to-follow code.
Change Subplot Title Position in Matplotlib
When you create subplots in Python, Matplotlib automatically places the title above each subplot. But sometimes, the title may appear too close to the plot or not aligned the way you want.
I usually fix this by explicitly setting the x and y position of the subplot title. Let me show you how.
Method 1 – Use Python’s set_title() Parameters
The easiest way to change the subplot title position is by using the set_title() method. This method allows you to pass the x and y arguments to control the exact placement.
Here’s a simple Python example:
import matplotlib.pyplot as plt
# Create sample data
x = [1, 2, 3, 4, 5]
y1 = [2, 4, 6, 8, 10]
y2 = [1, 3, 5, 7, 9]
# Create subplots
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 5))
# First subplot
ax1.plot(x, y1, color="blue")
ax1.set_title("Sales Growth (East Coast)", x=0.5, y=1.05)
# Second subplot
ax2.plot(x, y2, color="green")
ax2.set_title("Sales Growth (West Coast)", x=0.5, y=1.05)
plt.tight_layout()
plt.show()You can refer to the screenshot below to see the output.

In this Python code, I used x=0.5 to center the title horizontally and y=1.05 to move it slightly above the plot. This small adjustment ensures the title doesn’t overlap with the data.
Method 2 – Use Python’s ax.title.set_position()
Another way I often use is the set_position() method. This gives you more explicit control over subplot title placement.
Here’s the Python example:
import matplotlib.pyplot as plt
# Create sample data
x = [10, 20, 30, 40, 50]
y1 = [15, 25, 35, 45, 55]
y2 = [5, 15, 20, 25, 30]
# Create subplots
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 5))
# First subplot
ax1.plot(x, y1, color="red")
title1 = ax1.set_title("Revenue Trend (NYC)")
title1.set_position([0.5, 1.1])
# Second subplot
ax2.plot(x, y2, color="purple")
title2 = ax2.set_title("Revenue Trend (Chicago)")
title2.set_position([0.5, 1.1])
plt.tight_layout()
plt.show()You can refer to the screenshot below to see the output.

In this Python example, the list [0.5, 1.1] sets the horizontal and vertical position. This method is great when you want precise control over subplot title placement.
Change Subplot Title Padding in Matplotlib
Sometimes the issue is not the position but the spacing between the subplot and its title. By default, Matplotlib uses a fixed padding, which may not always look good.
I usually adjust the padding to make the chart look cleaner. Let’s explore how to do that in Python.
Method 1 – Use Python’s pad Parameter in set_title()
The simplest way to change subplot title padding is by using the pad parameter.
Here’s the Python code:
import matplotlib.pyplot as plt
# Create sample data
x = [1, 2, 3, 4, 5]
y1 = [2, 5, 7, 10, 12]
y2 = [3, 6, 9, 12, 15]
# Create subplots
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 5))
# First subplot with more padding
ax1.plot(x, y1, color="orange")
ax1.set_title("Quarterly Profits (Texas)", pad=20)
# Second subplot with less padding
ax2.plot(x, y2, color="brown")
ax2.set_title("Quarterly Profits (California)", pad=5)
plt.tight_layout()
plt.show()You can refer to the screenshot below to see the output.

In this Python example, I used pad=20 for Texas and pad=5 for California. You can see how the padding creates extra spacing between the title and the plot.
Method 2 – Adjust Padding with rcParams
If you want to apply consistent padding to all subplot titles in your Python project, you can use rcParams.
Here’s how:
import matplotlib.pyplot as plt
# Change default padding for all subplot titles
plt.rcParams['axes.titlepad'] = 25
# Create sample data
x = [100, 200, 300, 400, 500]
y1 = [50, 100, 150, 200, 250]
y2 = [80, 160, 240, 320, 400]
# Create subplots
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 5))
# First subplot
ax1.plot(x, y1, color="navy")
ax1.set_title("Population Growth (Florida)")
# Second subplot
ax2.plot(x, y2, color="teal")
ax2.set_title("Population Growth (California)")
plt.tight_layout()
plt.show()You can refer to the screenshot below to see the output.

In this Python example, I set axes.titlepad = 25 to apply the same padding across all subplot titles. This method is useful when you want a consistent style across multiple charts.
Additional Styling Tips for Subplot Titles
While position and padding are the main focus, I also like to tweak other style properties of subplot titles in Python.
- Font Size: Use
fontsize=14to make titles more readable. - Bold Text: Use
fontweight="bold"to highlight important titles. - Color: Use
color="darkblue"to match your chart theme.
Here’s a quick Python example:
import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5]
y = [5, 10, 15, 20, 25]
fig, ax = plt.subplots(figsize=(6, 4))
ax.plot(x, y, color="black")
ax.set_title("Employment Rate (USA)", fontsize=16, fontweight="bold", color="darkblue", pad=15)
plt.show()These small adjustments make the subplot titles look more professional and easier to read.
Changing subplot title style in Python’s Matplotlib is simple but powerful. By adjusting the position and padding, you can make your charts much more readable.
I’ve shown you multiple methods, from using set_title() parameters to applying global changes with rcParams. Each method has its own use case, and you can pick the one that best fits your project.
You may like to read:
- Plot a Horizontal Bar Chart in Python Matplotlib
- Matplotlib Subplot Figure Size in Python
- Set Titles for Each Subplot and Overall Title in Matplotlib
- Matplotlib Subplot Titles – Change Font Size and Bold Text

I am Bijay Kumar, a Microsoft MVP in SharePoint. Apart from SharePoint, I started working on Python, Machine learning, and artificial intelligence for the last 5 years. During this time I got expertise in various Python libraries also like Tkinter, Pandas, NumPy, Turtle, Django, Matplotlib, Tensorflow, Scipy, Scikit-Learn, etc… for various clients in the United States, Canada, the United Kingdom, Australia, New Zealand, etc. Check out my profile.