繪製HIST數字I有兩個數據列表數據值(每個100個號碼)D1 = [0.5,0.6,0.45,........],D2 = [ 0.45,0.65,........]。我想用兩個列表數據繪製兩個hist,如下圖所示!如何用matplotlib繪製它,謝謝! 我的代碼如下:python3:如何由兩個列表數據與matplotlib
def plot_data(d1, d2):
fig, ax = plt.subplots()
ax.hist(d1, 100, 50, ec='red', fc='none', lw=1.5, histtype='step', label='n-gram')
ax.hist(d2, 100, 50, ec='green', fc='none', lw=1.5, histtype='step', label='ensemble')
ax.legend(loc='upper left')
plt.show()
但有錯誤:
mn, mx = [mi + 0.0 for mi in range]
TypeError: 'int' object is not utterable
這是哪裏的代碼傳給你的錯誤。 – harshil9968
什麼@ harshil9968的意思是,有什麼你給我們的錯誤有什麼密謀這樣的數據沒有證據。 – Gormador