Is it possible to produce matplotlib plots from a generator without specifying beforehand the total number of plots? For example:
import numpy as np
import matplotlib.pyplot as plt
def gen():
for i in range(10):
yield np.random.random(100)
# Here something magic to avoid setting number of rows
fig, ax = plt.subplots(undetermined, 1)
g = gen()
for i, arr in enumerate(g):
ax[i].plot(arr)
The idea is to generate different plots without removing previous plots until StopIteration
. Is there something to allow this behavior?