Beispiel #1
0
def make_plot(name, glyph):
    glyph_renderer = Glyph(
        data_source = source,
        xdata_range = xdr,
        ydata_range = ydr,
        glyph = glyph,
    )

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

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

    plot.renderers.append(glyph_renderer)
    plot.tools = [pantool, wheelzoomtool]
    document.add(plot)
    session.store_document(document)
Beispiel #2
0
def make_plot(name, glyph):
    glyph_renderer = Glyph(
        data_source=source,
        xdata_range=xdr,
        ydata_range=ydr,
        glyph=glyph,
    )

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

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

    plot.renderers.append(glyph_renderer)
    plot.tools = [pantool, wheelzoomtool]
    document.add(plot)
    session.store_document(document)
Beispiel #3
0
glyph_renderer = Glyph(
        data_source = source,
        xdata_range = xdr,
        ydata_range = ydr,
        glyph = circle,
        )


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

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

plot.renderers.append(glyph_renderer)
plot.tools = [pantool,wheelzoomtool]
document.add(plot)
# not so nice.. but set the model doens't know
# that we appended to children
session.store_document(document)

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


Beispiel #4
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)