I am generating a total of 50+ figures but I do not wish to display them all. I would like to pick out the figures that I want to display. Is there any way to do it?
For example: I have 50 plots which are generated over the course of the program. At the end, when I enter plt.show(), it shows all the figures. However, I would like to display only 3 or 4 figures (but they aren't fixed i.e, I could plot figures 1, 2, 3, 4 at one time and another time I could plot figures 10, 27, 33, 45). Also, a separate function is generating these figures and I am returning all the figures.
Sample main script:
import matplotlib.pylab as plt
import numpy as np
from sampleplotfn import *
A = 1
omega = np.linspace(10,35,50)
for i in range(len(omega)):
fig1 = sinewave(A,omega[i])
plt.show()
samplepltfn.py
import numpy as np
import matplotlib.pylab as plt
def sinewave(A,omega):
t = np.linspace(0,10,25)
f = A*np.sin(omega*t)
fig1 = plt.figure()
plt.plot(f,t)
return fig1