本文整理匯總了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)