Skip to content

Instantly share code, notes, and snippets.

@jrhaberstroh
Created July 24, 2016 21:11
Show Gist options
  • Save jrhaberstroh/353fd1ab0cd5ca5bda6927690c396309 to your computer and use it in GitHub Desktop.
Save jrhaberstroh/353fd1ab0cd5ca5bda6927690c396309 to your computer and use it in GitHub Desktop.
# START: SAFESAVEPLOT
if not args.o is None:
import matplotlib
matplotlib.use("agg")
import matplotlib.pyplot as plt
def safesaveplot(out=None, suffix=None, transparent=False, clf=True):
fig = plt.gcf()
if out:
plt.savefig(out+suffix, transparent=transparent)
if clf:
plt.clf()
else:
plt.show()
# END: SAFESAVEPLOT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment