mirror of
https://github.com/wassname/matplotlibrc.git
synced 2026-09-09 11:26:43 +08:00
Adds output argument
This commit is contained in:
+7
-1
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user