I am trying to add subplots of differing sizes to a particular matplotlib figure, and am unsure of how to do so. In the case of there only being one figure, the "subplot2grid" can be utilized as follows:
import matplotlib.pyplot as plt
fig = plt.figure()
ax1 = plt.subplot2grid((2, 2), (0, 0), colspan=2)
ax1 = plt.subplot2grid((2, 2), (1, 1))
plt.show()
The above code creates a figure, and adds two subplots to that figure, each with different dimensions. Now, my issue arises in the case of having multiple figures -- I cannot find the appropriate way to add subplots to a particular figure using "subplot2grid." Using the more simple "add_subplot" method, one can add subplots to a particular figure, as seen in the below code:
import matplotlib.pyplot as plt
fig1 = plt.figure()
fig2 = plt.figure()
ax1 = fig1.add_subplot(2, 2, 1)
ax2 = fig1.add_subplot(2, 2, 4)
plt.show()
I am looking for the analogous method for adding subplots of different sizes (preferably using some sort of grid manager, e.g. "subplot2grid") to a particular figure. I have reservations about using the plt."x" style because it operates on the last figure that was created -- my code will have several figures, all of which I will need to have subplots of different sizes.
Thanks in advance,
Curtis M.