Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. import matplotlib
  2. matplotlib.use("Qt4Agg")
  3. import matplotlib.pyplot as plt
  4. ...
  5.  
  6. import matplotlib
  7. matplotlib.use("agg")
  8. import matplotlib.pyplot as plt
  9. ...
  10.  
  11. ...
  12. import os, sys, argparse
  13.  
  14. def main():
  15. parser = argparse.ArgumentParser()
  16. parser.add_argument("--noX", action="store_true", dest="noX")
  17. params = parser.parse_args()
  18.  
  19. data = [0,1,2,3,4,5]
  20. fig, ax = plt.subplots()
  21. ax.plot(data)
  22. if not params.noX:
  23. plt.show()
  24. plt.savefig("foo.png")
  25.  
  26. sys.exit(0)
  27.  
  28. if __name__ == "__main__":
  29. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement