Use the first 10, 20, 30 and 40 entries of the already computed list in a two-by-two array of axes. Each subplot needs an index sequence starting at one and having the same length as its data:
import matplotlib.pyplot as plt
fig, axes = plt.subplots(2, 2, figsize=(8, 6), layout="constrained")
for ax, stop in zip(axes.flat, [10, 20, 30, 40]):
ax.plot(range(1, stop + 1), list50[:stop])
ax.set(title=f"n = {stop}", xlabel="n", ylabel="f(n)")
plt.show()list50, even though the requested four panels stop at 40. Articles by others on the same topic
There are currently no matching articles.
