0
下面的代碼從numpy的ndarray閱讀每一行排列多個直方圖,並在同一圖中創建多個直方圖:Python的 - 如何在網格
fig, ax = plt.subplots(figsize=(10, 8))
fontP = FontProperties()
fontP.set_size('small')
for f in eval_list:
local_id = getIndexByIdentifier(f)
temp_sim = total_sim[local_id,:]
c=np.random.rand(3,1)
ax.hist(temp_sim, 10, ec=c, fc='none', lw=1.5, histtype='step', label=f)
ax.legend(loc="upper left", bbox_to_anchor=(1.1,1.1),prop = fontP)
而是包括所有直方圖一個情節,我怎麼能安排他們在一個網格5×5?
這裏是一個更新的代碼:
#Plot indvidual Histograms
SIZE = 10
all_data=[]
for f in eval_list:
local_id = getIndexByIdentifier(f)
temp_sim = total_sim[local_id,:]
all_data.append(temp_sim)
# create grid 10x10
fi, axi = plt.subplots(SIZE, SIZE,figsize=(50,50))
for idx, data in enumerate(all_data):
x = idx % SIZE
y = idx // SIZE
axi[y, x].hist(data)