Exemplo n.º 1
0
plot = Plot(x_range=xdr, y_range=ydr, data_sources=[source], border=80, title="Iris Data")
xaxis = LinearAxis(plot=plot, dimension=0, location="min", axis_label="petal length", bounds=(1, 7), major_tick_in=0)
yaxis = LinearAxis(plot=plot, dimension=1, location="min", axis_label="petal width", bounds=(0, 2.5), major_tick_in=0)
xgrid = Grid(plot=plot, dimension=0)
ygrid = Grid(plot=plot, dimension=1)

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

plot.renderers.append(glyph_renderer)
plot.tools = [pantool, zoomtool]

sess = session.HTMLFileSession("iris.html")
sess.add(plot, glyph_renderer, xaxis, yaxis, xgrid, ygrid, source, xdr, ydr, pantool, zoomtool)
sess.plotcontext.children.append(plot)
inject_1 = plot.script_direct_inject()
from numpy import pi, arange, sin, cos
import numpy as np
import os.path

from bokeh.objects import (
    Plot,
    DataRange1d,
    LinearAxis,
    ObjectArrayDataSource,
    ColumnDataSource,
    GlyphRenderer,
    PanTool,
    ZoomTool,
)
from bokeh.glyphs import Line
Exemplo n.º 2
0
                   bounds=(0, 2.5),
                   major_tick_in=0)
xgrid = Grid(plot=plot, dimension=0)
ygrid = Grid(plot=plot, dimension=1)

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

plot.renderers.append(glyph_renderer)
plot.tools = [pantool, zoomtool]

sess = session.HTMLFileSession("iris.html")
sess.add(plot, glyph_renderer, xaxis, yaxis, xgrid, ygrid, source, xdr, ydr,
         pantool, zoomtool)
sess.plotcontext.children.append(plot)
inject_1 = plot.script_direct_inject()
from numpy import pi, arange, sin, cos
import numpy as np
import os.path

from bokeh.objects import (Plot, DataRange1d, LinearAxis,
                           ObjectArrayDataSource, ColumnDataSource,
                           GlyphRenderer, PanTool, ZoomTool)
from bokeh.glyphs import Line
from bokeh import session

x = np.linspace(-2 * pi, 2 * pi, 1000)
y = sin(x)
z = cos(x)
widths = np.ones_like(x) * 0.02
heights = np.ones_like(x) * 0.2