What's the best way in matplotlib to make a series of subplots that all have the same X and Y scales, but where these are computed based on the min/max ranges of the subplot with the most extreme data? E.g. if you have a series of histograms you want to plot:
# my_data is a list of lists
for n, data in enumerate(my_data):
# data is to be histogram plotted
subplot(numplots, 1, n+1)
# make histogram
hist(data, bins=10)
Each histogram will then have different ranges/ticks for the X and Y axis. I'd like these to be all the same and set based on the most extreme histogram limits of the histograms plotted. One clunky way to do it is to record the min/max of X/Y axes for each plot, and then iterate through each subplot once they're plotted and just their axes after they're plotted, but there must be a better way in matplotlib.
Can this be achieved by some variant of axes sharing perhaps?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…