Пример #1
0
import sys
import requests

import numpy as np

from bokeh.glyphs import *
from bokeh.objects import (
    Plot, Range1d, LinearAxis, Grid, Glyph, ColumnDataSource, PanTool, WheelZoomTool
)
from bokeh import session
from bokeh import document

document = document.Document()
session = session.Session()
session.use_doc('prim_server')
session.load_document(document)

x = np.arange(1,6)
y = np.arange(5, 0, -1)

source = ColumnDataSource(data=dict(x=x,y=y))

xdr = Range1d(start=0, end=10)
ydr = Range1d(start=0, end=10)


def make_plot(name, glyph):
    glyph_renderer = Glyph(
        data_source = source,
        xdata_range = xdr,
        ydata_range = ydr,
Пример #2
0
import requests

from numpy import pi, sin, cos
import numpy as np

from bokeh.objects import (Plot, DataRange1d, LinearAxis, ColumnDataSource,
                           Glyph, PanTool, WheelZoomTool)
from bokeh.glyphs import Line

from bokeh import session
from bokeh import document

document = document.Document()
session = session.Session()
session.use_doc('line_animate')
session.load_document(document)

x = np.linspace(-2 * pi, 2 * pi, 1000)
x_static = np.linspace(-2 * pi, 2 * pi, 1000)
y = sin(x)
z = cos(x)

source = ColumnDataSource(data=dict(x=x, y=y, z=z, x_static=x_static))

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

line_glyph = Line(x="x", y="y", line_color="blue")
line_glyph2 = Line(x="x", y="z", line_color="red")
renderer = Glyph(data_source=source,