I have a script that generates matplotlib figures from data. Those plots are saved to disk as follows:
fig, ax = plt.subplots()
# create the plot
# ...
pickle.dump(ax, open(of, 'wb'))
In another script, I want to join certain of these plots. I can read the data back using:
figures = [pickle.load(file) for file in files]
(FWIW, figures that I read back have the type AxesSubplot
.)
So far so good. Now I want to put the data of two (or more) figures together, using either the largest or smallest scale of the available plots. Due to my lack of experience, I have absolutely no idea how to accomplish that. I did find questions about joining plots and the consensus was to plot in one figure in the first place. In my case that would be rather difficult as the plotting logic for a single data set is already complex. (There are other reasons why each dataset should be plotted on its own in a first step, and only then be potentially joined with others).
The plots I want to join represent their data in the same way - i.e. all of the plots are line plots or histograms (not really sure how to join those meaningfully) or QQPlots (see statsmodels.api). They may or may not have the same size of data.
How can I join the plots that are in different figures?