本文整理汇总了Python中bokeh.client.push_session方法的典型用法代码示例。如果您正苦于以下问题:Python client.push_session方法的具体用法?Python client.push_session怎么用?Python client.push_session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bokeh.client
的用法示例。
在下文中一共展示了client.push_session方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_server
# 需要导入模块: from bokeh import client [as 别名]
# 或者: from bokeh.client import push_session [as 别名]
def test_server():
session = push_session(curdoc())
session.show()
# create the figure
fig = figure(title='testing',
x_axis_label='iterations',
y_axis_label='value',
logo=None,
toolbar_location='right')
# create a new line
l = fig.line([], [], legend='test_line', name='test_line',
line_color='#1f77b4')
for i in range(100):
if i==0:
l.data_source.stream({'x':[i],'y':[10]})
else:
l.data_source.stream({'x':[i],'y':[i]})
time.sleep(0.05)
print 'done!'
示例2: run
# 需要导入模块: from bokeh import client [as 别名]
# 或者: from bokeh.client import push_session [as 别名]
def run(self):
print("In thread.run")
self.p = figure(plot_height=500, tools=TOOLS, y_axis_location='left', title=self.title)
self.p.x_range.follow = "end"
self.p.xaxis.axis_label = "Timestamp"
self.p.x_range.follow_interval = 100
self.p.x_range.range_padding = 0
self.p.line(x="timestamp", y="value", color="blue", source=self.source)
self.p.circle(x="timestamp", y="value", color="red", source=self.source)
self.session = push_session(curdoc())
curdoc().add_periodic_callback(self.update, 100) #period in ms
self.session.show(column(self.p))
curdoc().title = 'Sensor'
self.session.loop_until_closed()
# def register(self, d, sourceq):
# source = ColumnDataSource(dict(d))
# self.p.line(x=d[0], y=d[1], color="orange", source=source)
# curdoc().add_periodic_callback(self.update, 100) #period in ms
示例3: view
# 需要导入模块: from bokeh import client [as 别名]
# 或者: from bokeh.client import push_session [as 别名]
def view(plot,show=False):
from bokeh.plotting import curdoc
from bokeh.client import push_session
if show:
session = push_session(curdoc())
session.show(plot)
else:
curdoc().add_root(plot)