I am trying to run a python file ( test.py
) from command line in windows that contain a matplotlib plot. The file is running but the plot is only appearing for a fraction of second.
Here is the content of test.py
:
import matplotlib.pyplot as plt
plt.plot(range(10))
I am using the following command in cmd:
ipython test.py --matplotlib
The output is
Using matplotlib backend: Qt4Agg
The problem is the plot only appears for a fraction of second.
Modify like this:
import matplotlib.pyplot as plt
plt.plot(range(10))
plt.show()
And run like this:
python test.py
The way I like it
C:\Users\PC_NAME
) you have to copy.py file to your directory and only click on it there.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.