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
In my case, the error message was implying that I was working in a headless console. So plt.show() could not work. What worked was calling plt.savefig:
plt.show()
plt.savefig
import matplotlib.pyplot as plt plt.plot([1,2,3], [5,7,4]) plt.savefig("mygraph.png")
I found the answer on a github repository.