import numpy as np import matplotlib.pyplot as plt plt.rcParams["font.family"] = "DejaVu Serif" # 使用するフォント plt.rcParams["font.size"] = 20 # 文字の大きさ x = np.arange(-5,5,0.1) y = np.sin(x) plt.title("graph") plt.xlabel("x") plt.ylabel("y") plt.plot(x, y, label="sin x") plt.legend() plt.tight_layout() # フォントサイズが大きくなると文字が描画領域からはみ出るので、プロット全体に合わせて描画領域を大きくする。 plt.show()