I am running Windows 10 and when I run a script that use matplotlib.pyplot to create a plot, no plot is created if I run in the embedded terminal (either bash or powershell) in vscode. However, the figure window is shown in my task bar but I cannot open it.
I still get a plot when I run the script in jupyter. I also get a plot window when I run the script in the 'Terminal' app. So, I figured this problem has something to do with vscode.
The code I use is really simple:
import matplotlib.pyplot as plt
x = [1, 1]
plt.plot(x)
plt.show()
When you are plotting a graph in a script, make sure to use the following command to output the window displaying the graph.
plt.show()
By default, Jupyter outputs the graph, even when plt.show()
is not explicitly called.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With