When we have subplots in Matplotlib, do we call plt.show() for each one?


#1

Question

When we have subplots in Matplotlib, do we call plt.show() for each one?

Answer

No, we only need to call plt.show() one time after we create all the subplots we want to display.

If you do, however, have multiple plt.show() calls, you will see that the first time you call it, it will only display the subplots before that call. Then, the next plt.show() call will also show all previously defined subplots, including the ones shown on the previous plot. As a result, doing multiple plt.show() calls might not be a good idea.

Feel free to try this out, and see what happens!