Commit 5cb00a5b authored by thomas.forbriger's avatar thomas.forbriger
Browse files

proposp [WP]: set legend font size in plots

parent a8f3a78b
......@@ -59,6 +59,7 @@ def usage():
print(__version__)
print('Usage: '+sys.argv[0]+' [-v]')
print(' [-o file] [-g|--grid] [--nologlog] [--nologx] [--nology]')
print(' [--lfontsize s]')
print(' file [file [file ...]]')
print(' or: '+sys.argv[0]+' --help|-h')
......@@ -82,6 +83,7 @@ def help():
--nologlog plot on linear scales
--nologx use linear scale for x-axis
--nology use linear scale for y-axis
--lfontsize s set font size for legend
""")
# ============================================================================
......@@ -96,7 +98,7 @@ def main(argv=None):
try:
opts, args=getopt.getopt(sys.argv[1:], 'hvo:g', ['help', 'nologlog',
'nologx', 'nology', 'grid', 'xlabel'])
'nologx', 'nology', 'grid', 'xlabel', 'lfontsize'])
except getopt.GetoptError as err:
print(err.msg)
exit(0)
......@@ -110,6 +112,7 @@ def main(argv=None):
nology = False
grid = False
xlabel = 'frequency / Hz'
opt_legendfontsize='xx-small'
for (opt, arg) in opts:
if opt == '-v':
......@@ -120,6 +123,8 @@ def main(argv=None):
outfile=arg
elif opt in ('--xlabel'):
xlabel=arg
elif opt in ('--lfontsize'):
opt_legendfontsize=arg
elif opt in ("-g", "--grid"):
grid = True
elif opt in ("--nologlog"):
......@@ -184,7 +189,7 @@ def main(argv=None):
if verbose:
print('plot curve %d: %s' % (i, label))
plt.plot(data[:,0], data[:,i], label=label)
plt.legend()
plt.legend(fontsize=opt_legendfontsize)
if outfile=='x11':
plt.show(True)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment