How can I dynamically add a new plot to bunch of subplots if I\'m using more than one column to display my subplots? This answers this question for one column, but I cant se
Assuming at least 1 dimension of your grid and the total number of plots is known, I would use the gridspec module and a little bit of math.
import math
import matplotlib.pyplot as plt
from matplotlib import gridspec
def do_plot(ax):
ax.plot([1,2,3], [4,5,6], 'k.')
N = 11
cols = 3
rows = int(math.ceil(N / cols))
gs = gridspec.GridSpec(rows, cols)
fig = plt.figure()
for n in range(N):
ax = fig.add_subplot(gs[n])
do_plot(ax)
fig.tight_layout()