def test_noarg(self): default_kwargs = dict(session_id="default", url="default", app_path='/', autopush=False) io.output_server() self._check_func_called(io._state.output_server, (), default_kwargs)
def test_args(self): kwargs = dict(session_id="foo", url="http://example.com", app_path='/foo', autopush=True) io.output_server(**kwargs) self._check_func_called(io._state.output_server, (), kwargs)
def server(self, session_id): warnings.warn("Chart property 'server' was deprecated in 0.11 \ and will be removed in the future.") from bokeh.io import output_server if session_id: if isinstance(session_id, bool): session_id='default' output_server(session_id)
def server(self, session_id): warnings.warn("Chart property 'server' was deprecated in 0.11 \ and will be removed in the future.") from bokeh.io import output_server if session_id: if isinstance(session_id, bool): session_id = 'default' output_server(session_id)
def test_noarg(self): default_kwargs = dict(session=None, url="default", name=None, clear=True) io.output_server("docname") self._check_func_called(io._state.output_server, ("docname", ), default_kwargs)
def wrapper(*args, **kwargs): name = kwargs.pop('name', strftime('%I:%M:%S %h %d %Y')) width = kwargs.pop('w', 600) height = kwargs.pop('h', 600) output_server(name) p = figure(plot_width=width, plot_height=height) p = func(p, *args, **kwargs) show(p)
def test_io_push_to_server(self): from bokeh.io import output_server, push, curdoc, reset_output application = Application() with ManagedServerLoop(application) as server: reset_output() doc = curdoc() doc.clear() client_root = SomeModelInTestClientServer(foo=42) session_id = 'test_io_push_to_server' output_server(session_id=session_id, url=("http://localhost:%d/" % server.port)) doc.add_root(client_root) push(io_loop=server.io_loop) server_session = server.get_session('/', session_id) print(repr(server_session.document.roots)) assert len(server_session.document.roots) == 1 server_root = next(iter(server_session.document.roots)) assert client_root.foo == 42 assert server_root.foo == 42 # Now modify the client document and push client_root.foo = 57 push(io_loop=server.io_loop) server_root = next(iter(server_session.document.roots)) assert server_root.foo == 57 # Remove a root and push doc.remove_root(client_root) push(io_loop=server.io_loop) assert len(server_session.document.roots) == 0 # Clean up global IO state reset_output()
def stream(name, width=800, height=500): """ Broken """ output_server(name) p = figure(plot_width=width, plot_height=height) p.line([1,2,3], [4,5,6], name='ex_line') renderer = p.select({'name': 'ex_line'}) ds = renderer[0].data_source while True: x, y = yield ds.data['x'] = x ds.data['y'] = y cursession().store_objects(ds) show(p)
def test_args(self): kwargs = dict(session="session", url="url", name="name", clear="clear") io.output_server("docname", **kwargs) self._check_func_called(io._state.output_server, ("docname", ), kwargs)
import pandas as pd import numpy as np from bokeh.io import curdoc, vform, output_file, show, output_server from bokeh.layouts import row, column, widgetbox, layout from bokeh.models import ColumnDataSource, DateFormatter from bokeh.models.widgets import Slider, TextInput, Panel, Tabs, CheckboxGroup, Div from bokeh.models.widgets import Toggle, DataTable, DateFormatter, TableColumn, Button from bokeh.plotting import figure output_server('test2') files = ['urlvisits-20160823.csv', 'searches-20160823.csv', 'uniqueusers-20160823.csv', 'intab-20160823.csv'] names = ['URL Visits', 'Searches', 'Unique Users', 'In-Tab Users'] def create_panels(files, names): tab_list = [] for i in range(len(files)): df = pd.read_csv('reports/{}'.format(files[i])) col1 = df.columns[0] col2 = df.columns[1] if col1 == 'date': df['date'] = pd.to_datetime(df['date'])
__author__ = 'root' from bokeh.models import (TapTool, CustomJS) from bokeh.io import output_file, show from bokeh.io import curdoc, vform, gridplot, output_server import ClusteringSourceData as csd import GUIparams as gui import GUICallbacks as cb output_server("clusteringGUI") def plotClusters(source, p): color = ['red', 'red', 'green', 'blue', 'blue', 'red'] p.circle('x', 'y', source=source, color=color, size=source.data['size'], fill_alpha=0.2) p.square('x', 'y', source=source, size=source.data['tmedian'], color="#74ADD1", fill_alpha=0.2) p.triangle('x', 'y', source=source, size=source.data['sd'], color="#111DFF",
__author__ = 'root' from bokeh.models import ( TapTool, CustomJS) from bokeh.io import output_file, show from bokeh.io import curdoc, vform, gridplot, output_server import ClusteringSourceData as csd import GUIparams as gui import GUICallbacks as cb output_server("clusteringGUI") def plotClusters(source, p): color = ['red', 'red', 'green', 'blue', 'blue', 'red'] p.circle('x','y', source=source, color=color, size=source.data['size'], fill_alpha=0.2 ) p.square('x','y', source=source, size=source.data['tmedian'], color="#74ADD1", fill_alpha=0.2) p.triangle('x','y', source=source, size=source.data['sd'], color="#111DFF", fill_alpha=0.4) #print source.data['dates'] #output_file("clusteringGUI.html", title="clusterplot.py example") def UpdatePlot(source, source1): data_table.source=source1 plotClusters(source, p) #set callbacks #sliders[0].callback = cb.callbackMin(source) #sliders[1].callback = cb.callbackMax(source) #taptool.callback = cb.callbackTap(source) curdoc().add(vbox) #session = push_session(curdoc())
def connect_to_server(self): try: output_server("dreaml") except ConnectionError: reset_output() print "Failed to connect to bokeh server"
def test_noarg(self): default_kwargs = dict(session=None, url="default", name=None, clear=True) io.output_server("docname") self._check_func_called(io._state.output_server, ("docname",), default_kwargs)
def test_args(self): kwargs = dict(session="session", url="url", name="name", clear="clear") io.output_server("docname", **kwargs) self._check_func_called(io._state.output_server, ("docname",), kwargs)
import numpy as np from bokeh.plotting import figure from bokeh.io import show, output_server, vplot N = 9 x = np.linspace(-2, 2, N) y = x**2 sizes = np.linspace(10, 20, N) xpts = np.array([-.09, -.12, .0, .12, .09]) ypts = np.array([-.1, .02, .1, .02, -.1]) output_server("glyphs") plots = [] p = figure(title="annular_wedge") p.annular_wedge(x, y, 10, 20, 0.6, 4.1, color="#8888ee", inner_radius_units="screen", outer_radius_units="screen") plots.append(p)
def server(self): warnings.warn("Chart property 'server' was deprecated in 0.11 \ and will be removed in the future.") from bokeh.io import output_server output_server("default")
import numpy as np from bokeh.plotting import figure from bokeh.io import show, output_server, vplot N = 9 x = np.linspace(-2, 2, N) y = x**2 sizes = np.linspace(10, 20, N) xpts = np.array([-.09, -.12, .0, .12, .09]) ypts = np.array([-.1, .02, .1, .02, -.1]) output_server("glyphs") plots = [] p = figure(title="annular_wedge") p.annular_wedge(x, y, 10, 20, 0.6, 4.1, color="#8888ee", inner_radius_units="screen", outer_radius_units="screen") plots.append(p) p = figure(title="annulus") p.annulus(x, y, 10, 20, color="#7FC97F", inner_radius_units="screen", outer_radius_units = "screen") plots.append(p) p = figure(title="arc") p.arc(x, y, 20, 0.6, 4.1, radius_units="screen", color="#BEAED4", line_width=3) plots.append(p)