plt.show () is a blocking function.
Essentially, if you want to open two windows at once, you need to create two digits, and then use plt.show () at the end to display them. In fact, the general rule is that you customize your stories, and plt.show () is the last thing you do.
So in your case:
fig1 = plt.figure(figsize=plt.figaspect(0.75)) ax1 = fig1.add_subplot(1, 1, 1) im1, = plt.imshow(eye(3)) fig2 = plt.figure(figsize=plt.figaspect(0.75)) ax2 = fig2.add_subplot(1, 1, 1) im2, = plt.imshow(eye(2)) plt.show()
You can switch between graphs using axes(ax2) .
I have put together a detailed example that demonstrates why the plot function blocks and how it can be used in the answer to another question: https://stackoverflow.com/a/416829/
stanri
source share