Answers for "plt.savefig python not working"

1

plt.savefig without showing

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt

plt.plot([1,2,3])
plt.savefig('/tmp/test.png')
Posted by: Guest on October-06-2021
1

matplotlib savefig not working

# Call plt.show() after plt.savefig("filename.png")
# (Because plt.show() clears the plot from memory)
Posted by: Guest on April-23-2021

Python Answers by Framework

Browse Popular Code Answers by Language