No response to put.show()

Asked 2 years ago, Updated 2 years ago, 81 views

After installing Anaconda3(64bit) for windows and entering the following code in spyder, the graph appears on the console when you enter plt.plot(num, heoght), but plt.show() has no new window, no error message, and no response.

import numpy as np
import matplotlib.pyplot asplt
num = np.array ([1, 2, 3, 4, 5])
height = np.array ([100, 300, 200, 500, 400])
plt.plot(num, height)
plt.show()

I checked the version of PyQt at the command prompt and found that PyQt5 was installed and
I also looked at the matplotlib backend configuration and found that it was qt5agg.
Most of the solutions to the problems you find online regarding plt.show() are related to the backend configuration, and I'm at a loss because I can't find anything else to do.

I would appreciate your advice.Thank you for your cooperation.

python matplotlib pyqt

2022-09-30 21:34

1 Answers

The question is a successful response from spyder.

The console of spyder uses iPython by default, so you can only see a graph there and no windows.

If you run from Anaconda Prompt or modify the console settings in spyder to "Use External Terminal", a new window will appear for plt.show().However, I think it would be more convenient to use the standard console of spyder.


2022-09-30 21:34

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.