Following way to show a picture works:
import numpy as np
import matplotlib.pyplot as plt
x=np.linspace(0,5,100)
y=np.sin(x)
plt.plot(x, y)
plt.title("Plot generated using Matplotlib")
plt.xlabel("x")
plt.ylabel("sinx")
plt.show()
But following way does not show a picture in VSC:
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 10, 100)
fig = plt.figure()
plt.plot(x, np.sin(x), '-')
plt.plot(x, np.cos(x), '--');
By the way, both ways work out pictures in Jupyter notebook.
Where am I wrong? Thank you