def _create_plot_component(title, initial_values=None, on_change_functor=None): #return OverlayPlotContainer() container = OverlayPlotContainer(padding = 25, fill_padding = True, bgcolor = "lightgray", use_backbuffer=True) if initial_values: x = initial_values[0] y = initial_values[1] else: # Create the initial X-series of data numpoints = 30 low = -5 high = 15.0 x = linspace(low, high, numpoints) y = jn(0, x) lineplot = create_line_plot((x, y), color=tuple(COLOR_PALETTE[0]), width=2.0) lineplot.selected_color = "none" scatter = ScatterPlot(index = lineplot.index, value = lineplot.value, index_mapper = lineplot.index_mapper, value_mapper = lineplot.value_mapper, color = tuple(COLOR_PALETTE[0]), marker_size = 2) scatter.index.sort_order = "ascending" scatter.bgcolor = "white" scatter.border_visible = True add_default_grids(scatter) add_default_axes(scatter) scatter.tools.append(PanTool(scatter, drag_button="right")) # The ZoomTool tool is stateful and allows drawing a zoom # box to select a zoom region. zoom = ZoomTool(scatter, tool_mode="box", always_on=False, drag_button=None) scatter.overlays.append(zoom) point_dragging_tool = PointDraggingTool(scatter) point_dragging_tool.on_change_functor = on_change_functor scatter.tools.append(point_dragging_tool) container.add(lineplot) container.add(scatter) # Add the title at the top container.overlays.append(PlotLabel(title, component=container, font = "swiss 16", overlay_position="top")) #container.mx = lineplot.index.get_data() #container.my = lineplot.value.get_data() container.lineplot = lineplot return container
def _create_plot_component(): container = OverlayPlotContainer(padding=50, fill_padding=True, bgcolor="lightgray", use_backbuffer=True) # Create the initial X-series of data numpoints = 30 low = -5 high = 15.0 x = linspace(low, high, numpoints) y = jn(0, x) lineplot = create_line_plot((x, y), color=tuple(COLOR_PALETTE[0]), width=2.0) lineplot.selected_color = "none" scatter = ScatterPlot(index=lineplot.index, value=lineplot.value, index_mapper=lineplot.index_mapper, value_mapper=lineplot.value_mapper, color=tuple(COLOR_PALETTE[0]), marker_size=5) scatter.index.sort_order = "ascending" scatter.bgcolor = "white" scatter.border_visible = True add_default_grids(scatter) add_default_axes(scatter) scatter.tools.append(PanTool(scatter, drag_button="right")) # The ZoomTool tool is stateful and allows drawing a zoom # box to select a zoom region. zoom = ZoomTool(scatter, tool_mode="box", always_on=False, drag_button=None) scatter.overlays.append(zoom) scatter.tools.append(PointDraggingTool(scatter)) container.add(lineplot) container.add(scatter) # Add the title at the top container.overlays.append( PlotLabel("Line Editor", component=container, font="swiss 16", overlay_position="top")) return container
def _create_plot_component(): container = OverlayPlotContainer(padding = 50, fill_padding = True, bgcolor = "lightgray", use_backbuffer=True) # Create the initial X-series of data numpoints = 30 low = -5 high = 15.0 x = linspace(low, high, numpoints) y = jn(0, x) lineplot = create_line_plot((x,y), color=tuple(COLOR_PALETTE[0]), width=2.0) lineplot.selected_color = "none" scatter = ScatterPlot(index = lineplot.index, value = lineplot.value, index_mapper = lineplot.index_mapper, value_mapper = lineplot.value_mapper, color = tuple(COLOR_PALETTE[0]), marker_size = 5) scatter.index.sort_order = "ascending" scatter.bgcolor = "white" scatter.border_visible = True add_default_grids(scatter) add_default_axes(scatter) scatter.tools.append(PanTool(scatter, drag_button="right")) # The ZoomTool tool is stateful and allows drawing a zoom # box to select a zoom region. zoom = ZoomTool(scatter, tool_mode="box", always_on=False) scatter.overlays.append(zoom) scatter.tools.append(PointDraggingTool(scatter)) container.add(lineplot) container.add(scatter) # Add the title at the top container.overlays.append(PlotLabel("Line Editor", component=container, font = "swiss 16", overlay_position="top")) return container