Commit 95f52841 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

croposp [WP]: support graph markers

parent 2236205a
......@@ -63,6 +63,7 @@ def usage():
print(' [--legfontsize s] [--legpos p] [--title t]')
print(' [--xlabel l] [--ylabel l] [--titfontsize t]')
print(' [--xlim l] [--ylim l]')
print(' [--usemarkers]')
print(' file [file [file ...]]')
print(' or: '+sys.argv[0]+' --help|-h')
......@@ -87,6 +88,7 @@ def help():
--nologlog plot on linear scales
--nologx use linear scale for x-axis
--nology use linear scale for y-axis
--usemarkers use graph markers
--legfontsize s set font size for legend
--legpos p set position of legend
--title t set plot title
......@@ -117,7 +119,8 @@ def main(argv=None):
try:
opts, args=getopt.getopt(sys.argv[1:], 'hvo:g', ['help', 'nologlog',
'nologx', 'nology', 'grid', 'xlabel=', 'legfontsize=', 'title=',
'legpos=', 'titfontsize=', 'ylabel=', 'xlim=', 'ylim='])
'legpos=', 'titfontsize=', 'ylabel=', 'xlim=', 'ylim=',
'usemarkers'])
except getopt.GetoptError as err:
print(err.msg)
exit(0)
......@@ -138,6 +141,7 @@ def main(argv=None):
opt_legposition = 'best'
opt_xlim = None
opt_ylim = None
opt_usemarkers = False
for (opt, arg) in opts:
if opt == '-v':
......@@ -180,6 +184,8 @@ def main(argv=None):
nologx = True
elif opt in ("--nology"):
nology = True
elif opt in ("--usemarkers"):
opt_usemarkers = True
elif (opt == '-h') or (opt == '--help'):
help()
exit(0)
......@@ -229,6 +235,9 @@ def main(argv=None):
if opt_ylim is not None:
plt.ylim(opt_ylim[0], opt_ylim[1])
mymarkers=['o','*','p','v','<','>','P','X','d','D','.']
icurve=0
for specfile in args:
if verbose:
print('read file %s' % specfile)
......@@ -241,8 +250,12 @@ def main(argv=None):
label=re.sub('^# #\d+: ', '', labellines[i-1].strip())
if verbose:
print('plot curve %d: %s' % (i, label))
plt.plot(data[:,0], data[:,i], label=label)
themarker=None
if opt_usemarkers:
themarker=mymarkers[icurve % len(mymarkers)]
plt.plot(data[:,0], data[:,i], label=label, marker=themarker)
plt.legend(fontsize=opt_legendfontsize, loc=opt_legposition)
icurve=1+icurve
if opt_title is not None:
plt.title(re.sub('\\\\n','\n',opt_title), fontsize=opt_titlefontsize)
......
......@@ -247,6 +247,9 @@ psd%foutra.xxx: psd%.001.asc
# location of plot tool
CROPOSPLOT=../croposplot.py
# common options
CROPOSPLOT_OPT=--usemarkers
# ----------------------------------------------------------------------
# reference plots
# ---------------
......@@ -264,12 +267,14 @@ CPSD_RAWREFFILES=$(addprefix psd,$(addsuffix modfoutra.xxx,$(CPSD_SET) bg))
PSDraw.pdf: psdraw.xxx $(CPSD_RAWREFFILES)
$(CROPOSPLOT) --title="$@ \n $(CPSD_CROPOSP_OPT)" \
--ylim=1.e-14:100. \
$(CROPOSPLOT_OPT) \
--titfontsize='small' -v --grid -o $@ $^
# display PSD of apparent seismometer output in comparison with foutra
# analysis
PSD.pdf: psd_out.xxx $(CPSD_REFFILES)
$(CROPOSPLOT) --title="$@ \n $(CPSD_CROPOSP_OPT)" \
$(CROPOSPLOT_OPT) \
--titfontsize='small' -v --grid -o $@ $^
# ----------------------------------------------------------------------
......@@ -277,10 +282,12 @@ PSD.pdf: psd_out.xxx $(CPSD_REFFILES)
# -----------------------------
%.pdf: %_out.xxx
$(CROPOSPLOT) --title='$@ \n $(CPSD_CROPOSP_OPT)' \
$(CROPOSPLOT_OPT) \
--titfontsize='small' -v --grid -o $@ $<
%_lin.pdf: %_out.xxx
$(CROPOSPLOT) --title="$@ \n $(CPSD_CROPOSP_OPT)" \
$(CROPOSPLOT_OPT) \
--titfontsize='small' -v --grid --nology -o \
$@ $<
......
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