これはMatplotlibのタイトルと軸のラベルに関する記事です。

グラフにはタイトルラベルを付与することが出来ます。

適当な折れ線グラフを例にして解説します。

タイトルの構文

title(タイトル名)

 

軸のラベルの構文

xlabel(x軸のラベル名)

ylabel(y軸のラベル名)

 

import matplotlib.pyplot as plt

x = [2, 4, 8]
y = [3, 9, 6]

plt.plot(x, y)

plt.title("Test Title")

plt.xlabel("Test X Label Name")
plt.ylabel("Test Y Label Name")

plt.show()

 

出力結果