import pandas as pd
from numpy.random import randint
import matplotlib.pyplot as plt
df = pd.DataFrame(randint(0, 10, (200, 6)), columns=list('abcdef'))
grouped = df.groupby('a')
rowlength = grouped.ngroups / 2
fig, axs = plt.subplots(figsize=(9, 4), nrows=2, ncols=rowlength,
    gridspec_kw=dict(hspace=0.4))
targets = zip(list(grouped.groups.keys()), axs.flatten())
for i, (key, ax) in enumerate(targets):
    ax.plot(grouped.get_group(key))
ax.set_title('a=%d' % key)
ax.legend()
plt.show()
Как создать групповой график Pandas с подзаголовками?