Example #1
0
    wheelzoomtool = WheelZoomTool(dimensions=["width", "height"])

    plot = Plot(x_range=xdr, y_range=ydr, data_sources=[source], min_border=80)
    xaxis = LinearAxis(plot=plot)
    plot.below.append(xaxis)
    yaxis = LinearAxis(plot=plot)
    plot.left.append(yaxis)
    xgrid = Grid(plot=plot, dimension=0, ticker=xaxis.ticker)
    ygrid = Grid(plot=plot, dimension=1, ticker=yaxis.ticker)

    plot.renderers.append(glyph_renderer)
    plot.tools = [pantool, wheelzoomtool]
    document.add(plot)
    session.store_document(document)

make_plot('annular_wedge', AnnularWedge(x="x", y="y", inner_radius=0.2, outer_radius=0.5, start_angle=0.8, end_angle=3.8))
make_plot('annulus', Annulus(x="x", y="y", inner_radius=0.2, outer_radius=0.5))
make_plot('arc', Arc(x="x", y="y", radius=0.4, start_angle=0.8, end_angle=3.8))
make_plot('circle', Circle(x="x", y="y", radius=1))
make_plot('oval', Oval(x="x", y="y", width=0.5, height=0.8, angle=-0.6))
make_plot('ray', Ray(x="x", y="y", length=25, angle=0.6))
make_plot('rect', Rect(x="x", y="y", width=0.5, height=0.8, angle=-0.6))
make_plot('text', Text(x="x", y="y", text="foo", angle=0.6))
make_plot('wedge', Wedge(x="x", y="y", radius=0.5, start_angle=0.9, end_angle=3.2))

link = session.object_link(document._plotcontext)
print ("please visit %s to see plots" % link)



Example #2
0
                 glyph=line_glyph)
renderer2 = Glyph(data_source=source,
                  xdata_range=xdr_static,
                  ydata_range=ydr,
                  glyph=line_glyph2)

plot = Plot(x_range=xdr_static,
            y_range=ydr,
            data_sources=[source],
            min_border=50)
xaxis = LinearAxis(plot=plot, dimension=0, location="bottom")
yaxis = LinearAxis(plot=plot, dimension=1, location="left")

pantool = PanTool(dimensions=["width", "height"])
wheelzoomtool = WheelZoomTool(dimensions=["width", "height"])

plot.renderers.append(renderer)
plot.renderers.append(renderer2)
plot.tools = [pantool, wheelzoomtool]
document.add(plot)
session.store_document(document)
link = session.object_link(document._plotcontext)
print("please visit %s to see plots" % link)
print("animating")

while True:
    for i in np.linspace(-2 * pi, 2 * pi, 50):
        source.data['x'] = x + i
        session.store_objects(source)
        time.sleep(0.05)