Esempio n. 1
0
        ])

xdr = DataRange1d(sources=[source.columns("x")])
ydr = DataRange1d(sources=[source.columns("y")])

line_renderer = LineRenderer(
        data_source = source,
        xdata_range = xdr,
        ydata_range = ydr,
        color = "red",
        xfield = "x",
        yfield = "y",
        )

plot = Plot(x_range=xdr, y_range=ydr, data_sources=[source])
xaxis = LinearAxis(orientation="bottom", data_range=xdr)
yaxis = LinearAxis(orientation="left", data_range=ydr)

plot.axes = [xaxis, yaxis]
plot.renderers = [line_renderer]

sess = session.HTMLFileSession("glyph_line.html")
sess.server_static_dir="../bokeh/server"
sess.add(plot, line_renderer, xaxis, yaxis, source, xdr, ydr)
sess.save(js="relative", css="relative", rootdir=os.path.abspath("."))





Esempio n. 2
0
ydr = DataRange1d(sources=[source.columns("y")])

circle = Circle(x="x", y="y", fill="red", radius=5, line_color="black")

glyph_renderer = GlyphRenderer(
        data_source = source,
        xdata_range = xdr,
        ydata_range = ydr,
        glyph = circle,
        )

xaxis = LinearAxis(orientation="bottom", data_range=xdr)
yaxis = LinearAxis(orientation="right", data_range=ydr)

pantool = PanTool(dataranges = [xdr, ydr], dimensions=["width","height"])
zoomtool = ZoomTool(dataranges=[xdr,ydr], dimensions=("width","height"))

plot = Plot(x_range=xdr, y_range=ydr, data_sources=[source],
        border= 80)
plot.axes = [xaxis, yaxis]
plot.renderers = [glyph_renderer]
plot.tools = [pantool,zoomtool]

sess = session.PlotServerSession(username="******",
        serverloc="http://localhost:5006", userapikey="nokey")
sess.add(plot, glyph_renderer, xaxis, yaxis, source, xdr, ydr, pantool, zoomtool)
sess.use_doc("glyph2")
sess.store_all()