0

I have plotted several plots and saved them in my envoriment as plot1 plot2 etc. (18 plots in total) I want to put them in the same grid so that they are all shown as one image side by side (6 in a row with 3 rows) Unfortunately I am unable to re-plot them inside a plt.subplot function since plotting them takes a lot of time.

I tried assigning axises as my plots like this:

fig, axs = plt.subplots(3, 6)

axs[0, 0].enter = plot1

axs[0, 1] = plot2

but doesnt work. I also considered putting them in an image grid but that doesnt work eighter since they are plots and not images. the code below doesnt work for example:


import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid

fig = plt.figure(figsize=(4., 4.))
grid = ImageGrid(fig, 111,  # similar to subplot(111)
                 nrows_ncols=(2, 2),  # creates 2x2 grid of axes
                 axes_pad=0.1,  # pad between axes in inch.
                 )

for ax, im in zip(grid, [plot1, plot2, plot3, plot4]):
    # Iterating over the grid returns the Axes.
    ax.imshow(im)

plt.show()
Echo
  • 1
  • Does this answer your question? [How to add already created figures to a subplot figure](https://stackoverflow.com/questions/70696896/how-to-add-already-created-figures-to-a-subplot-figure) – BigBen Dec 08 '22 at 18:27
  • From the linked thread: "You can't store plots for later use." – BigBen Dec 08 '22 at 18:28

0 Answers0