def plot_discont(self, fig=1): """ Plot discontinuties of a TimeSerie Object contained in discont list Parameters ---------- fig : int or Figure object, optional Figure ID where the data will be plotted can accept a int (id of a Figure) OR the figure Object itself. The default is 1. Returns ------- None. """ if not self.bool_discont: print("WARN : no discontinuities in TimeSerie") return None if type(fig) is int: figobj = plt.figure(fig) elif type(fig) is plt.Figure: figobj = fig for ax in figobj.axes: stats.plot_vertical_bar_ax(self.discont, ax, "r") if self.bool_discont_manu: for ax in figobj.axes: stats.plot_vertical_bar_ax(self.discont_manu, ax, "g")
def onclick_discont(event): if event.key == ' ': if Xdata_are_time: ix, iy = matplotlib.dates.num2date(event.xdata).replace(tzinfo=None),event.ydata else: ix, iy = event.xdata , event.ydata print("INFO : X value recorded : " , ix) for ax in figobj.axes: out_bar_list = stats.plot_vertical_bar_ax([ix],ax,"b", linewidth=1) self.ver_bar_stk.append(out_bar_list[0]) self.selectedX.append(ix) plt.draw() elif event.key == 'r' and len(self.selectedX) > 0: last = self.selectedX[-1] self.selectedX.remove(last) #for ax in figobj.axes: # stats.plot_vertical_bar_ax([last],ax,"r") last_bar = self.ver_bar_stk[-1] self.ver_bar_stk.remove(last_bar) last_bar.remove() print("INFO : value removed : " , last ) plt.draw() return None
def plot_discont(self,fig=1): if not self.bool_discont: print("WARN : pas de discontinuité dans la TS") return 0 if type(fig) is int: figobj = plt.figure(fig) elif type(fig) is plt.Figure: figobj = fig for ax in figobj.axes: stats.plot_vertical_bar_ax(self.discont,ax,"r") if self.bool_discont_manu: for ax in figobj.axes: stats.plot_vertical_bar_ax(self.discont_manu,ax,"g")
def onclick_discont(event): ix, iy = matplotlib.dates.num2date(event.xdata).replace(tzinfo=None), event.ydata print("INFO : discontinuity recorded : " , ix) for ax in figobj.axes: stats.plot_vertical_bar_ax([ix],ax,"g") # self.bool_discont = True self.bool_discont_manu = True self.discont.append(ix) self.discont = sorted(self.discont) self.discont_manu.append(ix) self.discont_manu = sorted(self.discont_manu) #figobj.show() plt.draw() return None