From 84c782f8d7b658e7847142f791e25be82ada8e42 Mon Sep 17 00:00:00 2001 From: Simon Walker Date: Tue, 5 Nov 2013 16:07:58 +0000 Subject: [PATCH] Adds output argument --- showstyle.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/showstyle.py b/showstyle.py index b80e498..2420f5f 100755 --- a/showstyle.py +++ b/showstyle.py @@ -12,7 +12,10 @@ ap = argparse.ArgumentParser() ap.add_argument('style', help='Which rc file to use. One of %s' % available) ap.add_argument('--plot', default='all', help='One of [scatter, hist, line, image], or ' 'a comma-separated list of a subset. Default is all.') +ap.add_argument('--output', required=False, help='Render the plot to a file') +print "Here" args = ap.parse_args() +print "Here" matplotlib.rc_file(os.path.join(HERE, 'rc', args.style)) @@ -66,4 +69,7 @@ if 'image' in args.plot or args.plot == 'all': ax = fig.add_subplot(224) image(ax) -plt.show() +if args.output: + plt.savefig(args.output) +else: + plt.show()