how to add subtitle matplotlib

Solutions on MaxInterview for how to add subtitle matplotlib by the best coders in the world

showing results for - "how to add subtitle matplotlib"
Paul
22 Feb 2016
1import pandas as pd
2import matplotlib.pyplot as plt
3
4d = {'series a' : pd.Series([1., 2., 3.], index=['a', 'b', 'c']),
5      'series b' : pd.Series([1., 2., 3., 4.], index=['a', 'b', 'c', 'd'])}
6df = pd.DataFrame(d)
7
8title_string = "This is the title"
9subtitle_string = "This is the subtitle"
10
11plt.figure()
12df.plot(kind='bar')
13plt.suptitle(title_string, y=1.05, fontsize=18)
14plt.title(subtitle_string, fontsize=10)