しょっちゅう忘れることを書いておく。
![]() |
66 |
475 views
# coding: UTF-8
import matplotlib.pyplot as plt
import numpy as np
left = np.array([1, 2, 3, 4, 5])
height1 = np.array([100, 200, 300, 400, 500])
height2 = np.array([3, 4, 5, 6, 7])
height3 = np.array([4, 5, 6, 7, 8])
height4 = np.array([10, 20, 30, 40, 50])
fig = plt.figure()
bar1 = fig.add_subplot(2, 2, 1)
bar1.bar(left, height1)
bar2 = fig.add_subplot(2, 2, 2)
bar2.bar(left, height2)
bar3 = fig.add_subplot(2, 2, 3)
bar3.bar(left, height3)
bar4 = fig.add_subplot(2, 2, 4)
bar4.bar(left, height4)
plt.show()
subplotの第一引数は横に2分割、第二引数は縦に二分割、第三引数は何番目に表示するかを表す。
Page 50 of 69.
すぺぺぺ
本サイトの作成者。
プログラムは趣味と勉強を兼ねて、のんびり本サイトを作っています。
フレームワークはdjango。
ChatGPTで自動プログラム作成に取り組み中。
https://www.osumoi-stdio.com/novel/