I am trying to keep all iterations of this loop on the same subplot figure. For example, here is the plotting part of my code (omitting how I obtain data).
for N in range(6,10):
fig,axs = plt.subplots(2, 2 , sharex=True)
axs[0, 0].plot(t1, xnew[0::4])
axs[0, 0].set_title('Minimize Position')
axs[0, 0].legend(["Position"],loc='best')
axs[0, 1].plot(t1, xnew[1::4], 'tab:orange')
axs[0, 1].set_title('Minimize Radians')
axs[0, 1].legend(["Radians"],loc='best')
axs[1, 0].plot(rk4_inter.t,rk4_inter.y[1], 'tab:green')
axs[1, 0].set_title('RK4 Position')
axs[1, 0].legend(["Position"],loc='best')
axs[1, 1].plot(rk4_inter.t,rk4_inter.y[2], 'tab:red')
axs[1, 1].set_title('RK4 Radians')
axs[1, 1].legend(["Radians"],loc='best')
fig.suptitle('Minimize and RK4 Solutionslabel % s collocations' % N, fontsize=14)
fig.tight_layout()
plt.show()
As I iterate through this loop. I cannot figure out how to keep all iterations (6-9) on the same subplot figure. Currently, my code just creates new separate subplots and figures for each iteration as I loop through. I greatly appreciate any help.