“UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.” when plotting figure with pyplot on Pycharm

前端 未结 14 814
梦谈多话
梦谈多话 2020-12-22 18:33

I am trying to plot a simple graph using pyplot, e.g.:

import matplotlib.pyplot as plt
plt.plot([1,2,3],[5,7,4])
plt.show()

but the figure

14条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-22 18:56

    When I ran into this error on Spyder, I changed from running my code line by line to highlighting my block of plotting code and running that all at once. Voila, the image appeared.

提交回复
热议问题