2016-03-07 61 views
0

我正在處理一組時間序列數據。我已經把這個集合分成了108個窗口(單個時間窗口是1個月)。然後我繪製每個窗口的直方圖。所以我有108個直方圖,從時間窗口1到窗口108,它們按時間順序排列(從2006年11月到2015年10月,108個時間窗口)。在matplotlib中連接多個直方圖

我想要做的事: 是將所有這108個直方圖繪製爲一個水平長的直方圖。所以它就是完全添加它們。例如,繪製窗口1的直方圖,並在窗口1的直方圖之後沒有任何間隙的情況下,需要爲窗口2和3,4,5,6 ,,,,,,提供一個直方圖,直到窗口108.我該怎麼做在Python中?

Want to add other histograms beside in orders

回答

1

這可能會有所幫助:

plt.figure(figsize = (4,4)) 
gs1 = gridspec.GridSpec(4, 4) 
gs1.update(wspace=0.0, hspace=0.) # set the spacing between axes. 

for i in range(16): 
    ax1 = plt.subplot(gs1[i]) 
    plt.axis('on') 
    ax1.set_xticklabels([]) 
    ax1.set_yticklabels([]) 
    ax1.set_aspect('equal') 
#  plt.subp 

plt.show() 

你需要控制次要情節之間的間距。 for循環刪除刻度標籤並執行其他一些格式化,並且您想要根據自己的情況更改它們。

來源: How to remove gaps between subplots in matplotlib?