実現したいこと
pythonを使用しています。
matplotlib で棒グラフを描きたいと思っています。
そこで、
https://pythondatascience.plavox.info/matplotlib/%E6%A3%92%E3%82%B0%E3%83%A9%E3%83%95
というサイトの
基本的な棒グラフの出力例
5 本の棒を出力
python
1import numpy as np 2import matplotlib.pyplot as plt 3 4left = np.array([1, 2, 3, 4, 5]) 5height = np.array([100, 200, 300, 400, 500]) 6plt.bar(left, height)
を参照して
python
1import numpy as np 2import matplotlib.pyplot as plt 3 4R = [30000, 60000, 90000, 120000, 150000, 180000, 210000, 240000, 270000, 300000, 330000, 360000, 390000, 420000, 450000, 480000, 510000, 540000, 570000, 600000, 630000, 660000, 690000, 720000, 750000, 780000, 810000, 840000, 870000, 900000, 930000, 960000, 990000, 1020000, 1050000, 1080000, 1110000, 1140000, 1170000, 1200000, 1230000, 1260000, 1290000, 1320000, 1350000, 1380000, 1410000, 1440000, 1470000, 1500000, 1530000, 1560000, 1590000, 1620000, 1650000, 1680000, 1710000, 1740000, 1770000] 5 6H = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10] 7 8left = np.array(R) 9height = np.array(H) 10plt.bar(left, height)
を試したのですが、
<BarContainer object of 6 artists>
![
と出てくるだけで、うまい具合に棒グラフが表示されません。
どうすればよいでしょうか。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。