简体   繁体   中英

Concatenate multiple histograms in matplotlib

I am dealing with a set of time series data. And I have separated this set into 108 windows by time(a single time window is 1-month long). And then I plot a histogram for each window. So I have 108 histograms, from time window1 to window108 they are in chronological order(from November 2006 to October 2015, 108 time windows).

What I want to do: is to plot all these 108 histograms as a one horizontally long histogram. So it is like to add them altogether. For example, plot histogram for window1, and right after the histogram for window1 without having any gap there need to be a histogram for window2 and 3,4,5,6,,,,,,until window 108. How do I do this in Python?

要在订单旁边添加其他直方图

This might be helpful:

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()

You need to control the spacing between subplots. The for loop removes the tick labels and does some other formatting, and you want to change them for your situation.

source: How to remove gaps between subplots in matplotlib?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM