def _plot_default(self): self.data = self._data_default() plot = Plot(self.data) for ii, s_name in enumerate(self._samples): color = COLORS[ii % len(self._samples)] plot.plot(('bins',s_name), name=s_name, type='filled_line', edge_color=color, face_color=color, alpha=0.5, bgcolor='white', render_style='hold') # render_style determines whether interpolate plot.index = plot._get_or_create_datasource('bins') #set index name manually so range selection works plot.index_scale = 'log' plot.title = 'Fermi Plot' plot.padding = 50 plot.legend.visible = True plot.tools.append(PanTool(plot)) plot.active_tool = RangeSelection(plot) plot.overlays.append(RangeSelectionOverlay(component=plot)) zoom = ZoomTool(component=plot, tool_mode='box', always_on=False) plot.overlays.append(zoom) return plot
def _plot_default(self): self.data = self._data_default() plot = Plot(self.data) for ii, s_name in enumerate(self._samples): color = COLORS[ii % len(self._samples)] plot.plot( ("bins", s_name), name=s_name, type="filled_line", edge_color=color, face_color=color, alpha=0.5, bgcolor="white", render_style="hold", ) # render_style determines whether interpolate plot.index = plot._get_or_create_datasource("bins") # set index name manually so range selection works plot.index_scale = "log" plot.title = "Fermi Plot" plot.padding = 50 plot.legend.visible = True plot.tools.append(PanTool(plot)) plot.active_tool = RangeSelection(plot) plot.overlays.append(RangeSelectionOverlay(component=plot)) zoom = ZoomTool(component=plot, tool_mode="box", always_on=False) plot.overlays.append(zoom) return plot
def _stackedhist_default(self): plot = Plot(self.stackedhist_data, padding=(25, 0, 5, 20)) plot_selected = plot.plot(('index', 'selected'), type='bar', bar_width=1, fill_color='red', line_color='red') plot_parkinson = plot.plot(('index', 'positives'), type='bar', bar_width=0.5, fill_color='yellow', line_color='yellow') plot_control = plot.plot(('index', 'negatives'), name="select", type='bar', bar_width=0.5, fill_color='blue', line_color='blue') # set the plot's value low range to 0, otherwise it will pad too much plot.value_range = DataRange1D(low_settings=0) legend = Legend(component=plot, padding=5, align='ur', plots={'Control': plot_control, 'Parkinson': plot_parkinson}) plot.overlays.append(legend) #return plot zoomplot = Plot(self.stackedhist_data, padding=(25, 0, 5, 20)) zoomplot_selected = zoomplot.plot(('index', 'selected'), type='bar', bar_width=1, fill_color='red', line_color='red') zoomplot_parkinson = zoomplot.plot(('index', 'positives'), type='bar', bar_width=0.5, fill_color='yellow', line_color='yellow') zoomplot_control = zoomplot.plot(('index', 'negatives'), type='bar', bar_width=0.5, fill_color='blue', line_color='blue') zoomplot.value_range = DataRange1D(low_settings=0) zoomplot.index_axis.title = "Class count / patch" outer_container = VPlotContainer(padding=20, fill_padding=True, spacing=0, stack_order='top_to_bottom', bgcolor='lightgray', use_backbuffer=True) plot.index = plot_control[0].index outer_container.add(plot) outer_container.add(zoomplot) plot.controller = RangeSelection(plot) zoom_overlay = ZoomOverlay(source=plot, destination=zoomplot) outer_container.overlays.append(zoom_overlay) return outer_container