In Jupyter notebook (Python) within Visual Studio Code, when I run the following, a Figure with an Axes is plotted/shown in the output of the cell.
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
Instead, I expected only that the Figure and Axes objects would be saved to fig, ax. I tried adding a semicolon after subplots(), but that made no difference. Also, adding %matplotlib inline
did not help.
Is this a behavior specific to notebooks within Visual Studio Code? How can I prevent the plot showing immediately in the output when calling subplots()?