Closed cangubur closed 5 years ago
If anyone has the same issue this works:
values = [500,300,100,50,10] for v in values: plt.imshow(compress(face,v), cmap=plt.cm.gray) plt.figure(v)
Great post. In your first example, maybe rearranging like this would work:
values = [500,300,100,50,10]
for i in values:
plt.figure(i)
plt.imshow(compress(face,i), cmap=plt.cm.gray)
plt.figure()
creates a new figure. Here's a generic example:
import numpy as np
from matplotlib import pyplot as plt
for n in range(5):
x = np.linspace(0, (n+1) * np.pi,100)
y = np.sin(x)
plt.figure()
plt.title(str(n+1))
plt.plot(x,y)
returns:
I am trying to plot the requested images using a for loop and I can print everything except the last one. My code is:
values = [500,300,100,50,10] for i in values: plt.imshow(compress(face,i), cmap=plt.cm.gray) plt.figure(i) plt.plot()
why can't I print the last image?