I am trying to plot two different sets of functions going once through a double loop. I don\'t know how I can ask subplot2grid to act on the second figure.
impo
You should use the object-oriented interface. Here is an example:
import numpy as np
from matplotlib import pyplot as plt
t = np.linspace(0, 1, 100)
fig1, axes1 = plt.subplots(3, 3)
fig2, axes2 = plt.subplots(3, 3)
blue, red = "#1E90FF", "#FF6347"
for i in range(3):
for j in range(3):
axes1[i, j].plot(t, np.sin((t * np.random.random() * 10)), blue)
axes2[i, j].plot(t, np.cos((t * np.random.random() * 10)), red)
fig1.tight_layout()
fig2.tight_layout()