Exemplo n.º 1
0
def _create_plot_component():

    # Create the index
    numpoints = 100
    low = -5
    high = 15.0
    x = arange(low, high, (high - low) / numpoints)
    plotdata = ArrayPlotData(x=x, y1=jn(0, x), y2=jn(1, x))

    # Create the left plot
    left_plot = Plot(plotdata)
    left_plot.x_axis.title = "X"
    left_plot.y_axis.title = "j0(x)"
    renderer = left_plot.plot(("x", "y1"),
                              type="line",
                              color="blue",
                              width=2.0)[0]
    renderer.overlays.append(
        LineInspector(renderer,
                      axis='value',
                      write_metadata=True,
                      is_listener=True))
    renderer.overlays.append(
        LineInspector(renderer,
                      axis="index",
                      write_metadata=True,
                      is_listener=True))
    left_plot.overlays.append(ZoomTool(left_plot, tool_mode="range"))
    left_plot.tools.append(PanTool(left_plot))

    # Create the right plot
    right_plot = Plot(plotdata)
    right_plot.index_range = left_plot.index_range
    right_plot.orientation = "v"
    right_plot.x_axis.title = "j1(x)"
    right_plot.y_axis.title = "X"
    renderer2 = right_plot.plot(("x", "y2"),
                                type="line",
                                color="red",
                                width=2.0)[0]
    renderer2.index = renderer.index
    renderer2.overlays.append(
        LineInspector(renderer2, write_metadata=True, is_listener=True))
    renderer2.overlays.append(
        LineInspector(renderer2, axis="value", is_listener=True))
    right_plot.overlays.append(ZoomTool(right_plot, tool_mode="range"))
    right_plot.tools.append(PanTool(right_plot))

    container = HPlotContainer(background="lightgray")
    container.add(left_plot)
    container.add(right_plot)

    return container
Exemplo n.º 2
0
def _create_plot_component():

    # Create the index
    numpoints = 100
    low = -5
    high = 15.0
    x = arange(low, high, (high - low) / numpoints)
    plotdata = ArrayPlotData(x=x, y1=jn(0, x), y2=jn(1, x))

    # Create the left plot
    left_plot = Plot(plotdata)
    left_plot.x_axis.title = "X"
    left_plot.y_axis.title = "j0(x)"
    renderer = left_plot.plot(("x", "y1"), type="line", color="blue",
                              width=2.0)[0]
    renderer.overlays.append(LineInspector(renderer, axis='value',
                                            write_metadata=True,
                                            is_listener=True))
    renderer.overlays.append(LineInspector(renderer, axis="index",
                                            write_metadata=True,
                                            is_listener=True))
    left_plot.overlays.append(ZoomTool(left_plot, tool_mode="range"))
    left_plot.tools.append(PanTool(left_plot))

    # Create the right plot
    right_plot = Plot(plotdata)
    right_plot.index_range = left_plot.index_range
    right_plot.orientation = "v"
    right_plot.x_axis.title = "j1(x)"
    right_plot.y_axis.title = "X"
    renderer2 = right_plot.plot(("x", "y2"), type="line", color="red",
                                width=2.0)[0]
    renderer2.index = renderer.index
    renderer2.overlays.append(LineInspector(renderer2, write_metadata=True,
                              is_listener=True))
    renderer2.overlays.append(LineInspector(renderer2, axis="value",
                              is_listener=True))
    right_plot.overlays.append(ZoomTool(right_plot, tool_mode="range"))
    right_plot.tools.append(PanTool(right_plot))

    container = HPlotContainer(background="lightgray")
    container.add(left_plot)
    container.add(right_plot)

    return container
Exemplo n.º 3
0
def _create_plot_component():
    # make 10 random points
    x = arange(10)
    x = ArrayDataSource(x, sort_order="ascending")
    y = random_sample(10)

    # Plot the data
    pd = ArrayPlotData(x=x, y=y)

    plot = Plot(pd)
    plot.orientation = 'v'
    line_plot = plot.plot(("x", "y"))[0]

    # Add the tool to the plot both as a tool and as an overlay
    tool = HittestTool(component=plot, line_plot=line_plot)
    plot.tools.append(tool)
    plot.overlays.append(tool)

    return plot
def _create_plot_component():
    # make 10 random points
    x = arange(10)
    x = ArrayDataSource(x, sort_order="ascending")
    y = random_sample(10)

    # Plot the data
    pd = ArrayPlotData(x=x, y=y)

    plot = Plot(pd)
    plot.orientation = 'v'
    line_plot = plot.plot(("x", "y"))[0]

    # Add the tool to the plot both as a tool and as an overlay
    tool = HittestTool(component=plot, line_plot=line_plot)
    plot.tools.append(tool)
    plot.overlays.append(tool)

    return plot