1
1つの列しかないファイルからデータを読み取る必要があります。次に、データの禁止されたヒストグラムをプロットします。しかし、次のコードによって、この図は私に0の行だけを示しています。txtファイルから1つのcoloumnデータのヒストグラムをプロットする
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
f= np.loadtxt('data Ties', unpack='False')
bins = np.linspace(0, 50, 100000)
plt.hist(f, bins, histtype='bar', rwidth=0.8)
plt.xlabel('Diameter')
plt.ylabel('Number of Chondrules')
plt.title('Distribution of chondules diameter')
plt.legend()
plt.show()
これは私が持っているデータの一部です:
168000
199300
120900
216900
200800
137800
214200
174600
48200
126500
58700
149500
47500
5600
178500
25400
163000
182000
51900
66700
90300
210600
117800
164000
215200
170000
182000
38800
72700
161200