def init_plot(self, signal, **kwargs): if not hasattr(self, 'signals'): return None size = self.signals[signal].shape[0] if 'labels' not in kwargs: if size > 1: labels = [signal+str(k) for k in range(size)] else: labels = [signal] else: labels = kwargs['labels'] ax_r, ax_c = size, 1 info = [] n_colors = len(self.colors) index = int([''.join(g) for _, g in groupby(self.label, str.isalpha)][-1]) % n_colors for k in range(ax_r): inf = [] for _ in range(ax_c): lines = [] lines += [{'linestyle': '-', 'color': self.colors_w[index]}] lines += [{'linestyle': '-', 'color': self.colors[index]}] if 'knots' in kwargs and kwargs['knots']: lines += [{'linestyle': 'None', 'marker': 'x', 'color': self.colors[index]}] if 'prediction' in kwargs and kwargs['prediction']: lines += [{'linestyle': 'None', 'marker': 'o', 'color': self.colors[index]}] dic = {'labels': ['t (s)', labels[k]], 'lines': lines} if 'xlim' in kwargs: dic['xlim'] = kwargs['xlim'] if 'ylim' in kwargs: dic['ylim'] = kwargs['ylim'] inf.append(dic) info.append(inf) return info
def init_plot(self, signal, **kwargs): if not hasattr(self, 'signals'): return None size = self.signals[signal].shape[0] if 'labels' not in kwargs: if size > 1: labels = [signal + str(k) for k in range(size)] else: labels = [signal] else: labels = kwargs['labels'] ax_r, ax_c = size, 1 info = [] n_colors = len(self.colors) index = int([''.join(g) for _, g in groupby(self.label, str.isalpha) ][-1]) % n_colors for k in range(ax_r): inf = [] for _ in range(ax_c): lines = [] lines += [{'linestyle': '-', 'color': self.colors_w[index]}] lines += [{'linestyle': '-', 'color': self.colors[index]}] if 'knots' in kwargs and kwargs['knots']: lines += [{ 'linestyle': 'None', 'marker': 'x', 'color': self.colors[index] }] if 'prediction' in kwargs and kwargs['prediction']: lines += [{ 'linestyle': 'None', 'marker': 'o', 'color': self.colors[index] }] dic = {'labels': ['t (s)', labels[k]], 'lines': lines} if 'xlim' in kwargs: dic['xlim'] = kwargs['xlim'] if 'ylim' in kwargs: dic['ylim'] = kwargs['ylim'] inf.append(dic) info.append(inf) return info