Skip to content

Instantly share code, notes, and snippets.

@elfcobe
Created August 3, 2014 04:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elfcobe/d9c4f6e8d12c525baa22 to your computer and use it in GitHub Desktop.
Save elfcobe/d9c4f6e8d12c525baa22 to your computer and use it in GitHub Desktop.
matplotlibでBackgroundに'agg'を設定しなくてはいけない場合
#!/usr/bin/python3
# coding: utf-8
import matplotlib
# Backend を agg に変更する
# matplatlib.pyplot を import する前に実行する
matplotlib.use('agg')
import matplotlib.pyplot as plt
def main_operating():
plt.plot([1, 2, 3, 4], [1, 4, 9, 18])
plt.ylabel('some numbers')
plt.show()
plt.savefig('test01.png')
if __name__ == '__main__':
main_operating()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment