diff --git a/pywafo/src/wafo/objects.py b/pywafo/src/wafo/objects.py index 94fbe67..77f1ad1 100644 --- a/pywafo/src/wafo/objects.py +++ b/pywafo/src/wafo/objects.py @@ -62,10 +62,13 @@ class LevelCrossings(WafoData): ''' def __init__(self, *args, **kwds): - super(LevelCrossings, self).__init__(*args, **kwds) - self.labels.title = 'Level crossing spectrum' - self.labels.xlab = 'Levels' - self.labels.ylab = 'Count' + options = dict(title='Level crossing spectrum', + xlab='Levels', ylab='Count', + plot_args=['b'], + plot_args_children=['r--'],) + options.update(**kwds) + super(LevelCrossings, self).__init__(*args, **options) + self.stdev = kwds.get('stdev', None) self.mean = kwds.get('mean', None) self.setplotter(plotmethod='step') @@ -448,15 +451,16 @@ class CyclePairs(WafoData): ''' def __init__(self, *args, **kwds): - super(CyclePairs, self).__init__(*args, **kwds) self.type_ = kwds.get('type_', 'max2min') self.stdev = kwds.get('stdev', None) self.mean = kwds.get('mean', None) - - self.labels.title = self.type_ + ' cycle pairs' - self.labels.xlab = 'min' - self.labels.ylab = 'max' - + + options = dict(title=self.type_ + ' cycle pairs', + xlab='min', ylab='max', + plot_args=['b.']) + options.update(**kwds) + super(CyclePairs, self).__init__(*args, **options) + def amplitudes(self): return (self.data - self.args) / 2. @@ -639,7 +643,7 @@ class TurningPoints(WafoData): >>> ts = wafo.objects.mat2timeseries(x) >>> tp = ts.turning_points() >>> mM = tp.cycle_pairs() - >>> h = mM.plot('.') + >>> h = mM.plot('x') See also @@ -663,7 +667,6 @@ class TurningPoints(WafoData): type_ = 'max2min' M = self.data[iM:-1:2] m = self.data[iM + 1::2] - return CyclePairs(M, m, type=type_) def mat2timeseries(x): diff --git a/pywafo/src/wafo/wafodata.py b/pywafo/src/wafo/wafodata.py index d473240..aaabf39 100644 --- a/pywafo/src/wafo/wafodata.py +++ b/pywafo/src/wafo/wafodata.py @@ -54,7 +54,7 @@ class WafoData(object): Plot with confidence interval >>> d3 = WafoData(np.sin(x),x) >>> d3.children = [WafoData(np.vstack([np.sin(x)*0.9, np.sin(x)*1.2]).T,x)] - >>> d3.children_args=[':r'] + >>> d3.plot_args_children=[':r'] >>> h = d3.plot() See also @@ -68,7 +68,9 @@ class WafoData(object): self.date = now() self.plotter = None self.children = None - self.children_args = [] + self.plot_args_children = kwds.get('plot_args_children',[]) + self.plot_args = kwds.get('plot_args',[]) + self.labels = AxisLabels(**kwds) self.setplotter() @@ -77,15 +79,15 @@ class WafoData(object): if self.children != None: plotbackend.hold('on') tmp = [] - child_args = args + tuple(self.children_args) + child_args = args + tuple(self.plot_args_children) for child in self.children: tmp1 = child.plot(*child_args, **kwds) if tmp1 != None: tmp.append(tmp1) if len(tmp) == 0: tmp = None - - tmp2 = self.plotter.plot(self, *args, **kwds) + main_args = args + tuple(self.plot_args) + tmp2 = self.plotter.plot(self, *main_args, **kwds) return tmp2, tmp def show(self):