Matplotlib allign uneven number of subplots

I want to plot 11 figures using subplots. My idea is to have 2 rows: 6 plots on the first, 5 on the second. I use the following code.

import matplotlib.pyplot as plt
import pandas as pd

fig, axes = plt.subplots(2, 6, figsize=(30, 8))
fig.tight_layout(h_pad=6, w_pad=6)

x = 0
y = 0

for i in range(0, 11):
    data = [[1, i*1], [2, i*2*2], [3, i*3*3]]

    df = pd.DataFrame(data, columns = ['x', 'y'])
    
    df.plot('x', ['y'], ax=axes[x,y])
    
    y += 1
    if y > 5:
        y = 0
        x += 1

fig.delaxes(ax=axes[1,5])

This works, but the bottom row is not aligned to the center, which makes the result a bit ugly. I want the figures to all be of the same size, so I cannot extend the last one to make everything even.

My question: how do I align the second row to be centered such that the full picture is symmetrical?

Answer

You could use gridspec dividing each row into 12 partitions and recombining them pairswise:

import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import pandas as pd

fig = plt.figure(figsize=(12, 5))
gs = gridspec.GridSpec(2, 12)

for i in range(0, 11):
    if i < 6:
        ax = plt.subplot(gs[0, 2 * i:2 * i + 2])
    else:
        ax = plt.subplot(gs[1, 2 * i - 11:2 * i + 2 - 11])
    data = [[1, i * 1], [2, i * 2 * 2], [3, i * 3 * 3]]
    df = pd.DataFrame(data, columns=['x', 'y'])

    df.plot('x', 'y', ax=ax)

plt.tight_layout()
plt.show()

subplots center 6 and 5 plots