matplotlibの棒グラフにタイトルをつける
matplotlib の棒グラフにタイトルをつけてみましょう。タイトルの表示は matplotlib の title という関数を使います。
from matplotlib import pyplot as plt
name = [1, 2, 3, 4]
value = [54, 67, 89, 103]
label = ['Monday', 'Tuesday', 'Wednesday', 'Thursday']
plt.title('Sales')
plt.bar(name, value, color='#effef0', edgecolor='#9ffea0', linewidth=5, width=0.7, tick_label=label)
plt.gca().spines['right'].set_visible(False)
plt.gca().spines['top'].set_visible(False)
plt.show()
このうち
plt.title('Sales')
がタイトルを表示する部分です。

Sales というタイトルがグラフの上についています。