def _plot_default(self): plot = Plot(self.plotdata) if self.signal in ("tpr", "co", "sv"): rc_signal = "resp_corrected_" + self.signal if rc_signal in self.plotdata.arrays and self.plotdata.arrays[ rc_signal].size > 0: # Plot the resp-uncorrected version underneath plot.plot(("peak_times", self.signal), type="line", color="purple") signal = rc_signal signal = self.signal elif self.signal == "hr": plot.plot(("peak_times", self.signal), type="line", color="purple") signal = "mea_hr" else: signal = self.signal # Create the plot plot.plot(("peak_times", signal), type="line", color="blue") plot.plot(("peak_times", signal, "beat_type"), type="cmap_scatter", color_mapper=jet, name="my_plot", marker="circle", border_visible=False, outline_color="transparent", bg_color="white", index_sort="ascending", marker_size=3, fill_alpha=0.8) # Tweak some of the plot properties plot.title = self.signal #"Scatter Plot With Lasso Selection" plot.title_position = "right" plot.title_angle = 270 plot.line_width = 1 plot.padding = 20 # Right now, some of the tools are a little invasive, and we need the # actual ScatterPlot object to give to them my_plot = plot.plots["my_plot"][0] # Attach some tools to the plot self.selection = BeatSelection(component=my_plot) my_plot.active_tool = self.selection selection_overlay = RangeSelectionOverlay(component=my_plot) my_plot.overlays.append(selection_overlay) # Set up the trait handler for the selection self.selection.on_trait_change(self._selection_changed, 'selection_completed') return plot
def _plot_default(self): # Create plotting components plotdata = ArrayPlotData(time=self.time, data=self.data) plot = Plot(plotdata) self.renderer = plot.plot(("time", "data"), color=self.line_color)[0] plot.title = self.name plot.title_position = "right" plot.title_angle = 270 plot.line_width = 1 plot.padding = 25 plot.width = 400 # Load the censor regions and add them to the plot for censor_region in self.censored_regions: # Make a censor region on the Timeseries object censor_region.plot = self.renderer censor_region.viz censor_region.set_limits(censor_region.start_time, censor_region.end_time) return plot