Created
March 16, 2019 11:26
-
-
Save qqpann/28c17208f1482473989094540792e895 to your computer and use it in GitHub Desktop.
[Matplotlib on server] #python #matplotlib
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://matplotlib.org/faq/howto_faq.html#matplotlib-in-a-web-application-server | |
# do this before importing pylab or pyplot | |
import matplotlib | |
matplotlib.use('Agg') | |
import matplotlib.pyplot as plt | |
fig = plt.figure() | |
ax = fig.add_subplot(111) | |
ax.plot([1,2,3]) | |
fig.savefig('test.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment