Commit 065c3087 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

croposp [WP]: let croposplot print title

parent 6d7adcf9
...@@ -59,7 +59,7 @@ def usage(): ...@@ -59,7 +59,7 @@ def usage():
print(__version__) print(__version__)
print('Usage: '+sys.argv[0]+' [-v]') print('Usage: '+sys.argv[0]+' [-v]')
print(' [-o file] [-g|--grid] [--nologlog] [--nologx] [--nology]') print(' [-o file] [-g|--grid] [--nologlog] [--nologx] [--nology]')
print(' [--lfontsize s]') print(' [--lfontsize s] [--title t]')
print(' file [file [file ...]]') print(' file [file [file ...]]')
print(' or: '+sys.argv[0]+' --help|-h') print(' or: '+sys.argv[0]+' --help|-h')
...@@ -84,6 +84,7 @@ def help(): ...@@ -84,6 +84,7 @@ def help():
--nologx use linear scale for x-axis --nologx use linear scale for x-axis
--nology use linear scale for y-axis --nology use linear scale for y-axis
--lfontsize s set font size for legend --lfontsize s set font size for legend
--title t set plot title
""") """)
# ============================================================================ # ============================================================================
...@@ -98,7 +99,7 @@ def main(argv=None): ...@@ -98,7 +99,7 @@ def main(argv=None):
try: try:
opts, args=getopt.getopt(sys.argv[1:], 'hvo:g', ['help', 'nologlog', opts, args=getopt.getopt(sys.argv[1:], 'hvo:g', ['help', 'nologlog',
'nologx', 'nology', 'grid', 'xlabel', 'lfontsize']) 'nologx', 'nology', 'grid', 'xlabel=', 'lfontsize=', 'title='])
except getopt.GetoptError as err: except getopt.GetoptError as err:
print(err.msg) print(err.msg)
exit(0) exit(0)
...@@ -113,6 +114,7 @@ def main(argv=None): ...@@ -113,6 +114,7 @@ def main(argv=None):
grid = False grid = False
xlabel = 'frequency / Hz' xlabel = 'frequency / Hz'
opt_legendfontsize='xx-small' opt_legendfontsize='xx-small'
opt_title = None
for (opt, arg) in opts: for (opt, arg) in opts:
if opt == '-v': if opt == '-v':
...@@ -125,6 +127,8 @@ def main(argv=None): ...@@ -125,6 +127,8 @@ def main(argv=None):
xlabel=arg xlabel=arg
elif opt in ('--lfontsize'): elif opt in ('--lfontsize'):
opt_legendfontsize=arg opt_legendfontsize=arg
elif opt in ('--title'):
opt_title=arg
elif opt in ("-g", "--grid"): elif opt in ("-g", "--grid"):
grid = True grid = True
elif opt in ("--nologlog"): elif opt in ("--nologlog"):
...@@ -191,6 +195,9 @@ def main(argv=None): ...@@ -191,6 +195,9 @@ def main(argv=None):
plt.plot(data[:,0], data[:,i], label=label) plt.plot(data[:,0], data[:,i], label=label)
plt.legend(fontsize=opt_legendfontsize) plt.legend(fontsize=opt_legendfontsize)
if opt_title is not None:
plt.title(opt_title)
if outfile=='x11': if outfile=='x11':
plt.show(True) plt.show(True)
else: else:
......
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