現在、統計学を勉強している学生なのですが、お試しでちょっとしたデータで箱ひげ図をmatplotlibで作ろうとしています。
python
1import numpy as np 2import matplotlib.pyplot as plt 3 4 5def read_csv(filename): 6 pass 7 8 9def box_plot(data): 10 11 import numpy as np 12 import matplotlib.pyplot as plt 13 14 # Fixing random state for reproducibility 15 16 # fake up some data 17 # spread = np.random.rand(50) * 100 18 19 center = np.average(data) 20 flier_high = np.max(data) 21 flier_low = np.min(data) 22 result = np.concatenate((data, center, flier_high, flier_low)) 23 24 fig4, ax4 = plt.subplots() 25 ax4.set_title('height of student') 26 ax4.boxplot(result, showfliers=False) 27 28 29if __name__ == '__main__': 30 31 data = [87, 143, 149, 163, 180, 186, 186, 212, 222, 32 247, 251, 255, 257, 261, 271, 274, 277, 281, 33 287, 296, 306, 347, 406, 449, 1300] 34 35 box_plot(data) 36
現在、matplotlibのサイトから丸々コピって編集しているのですが、自分のデータで箱ひげ図を作ル時にエラーが得ました。
ここでいうdimensionsとはどういう意味でしょうか?
error
1 2ValueError: all the input arrays must have same number of dimensions
寝る前にさらっとお聞かせ願います。
曖昧な部分は多いと思うのですが、経験から話を書かせていただけたら嬉しいです。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/01/24 11:50