當前位置: 首頁>>代碼示例>>Python>>正文


Python plotting.curdoc方法代碼示例

本文整理匯總了Python中bokeh.plotting.curdoc方法的典型用法代碼示例。如果您正苦於以下問題:Python plotting.curdoc方法的具體用法?Python plotting.curdoc怎麽用?Python plotting.curdoc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在bokeh.plotting的用法示例。


在下文中一共展示了plotting.curdoc方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: run

# 需要導入模塊: from bokeh import plotting [as 別名]
# 或者: from bokeh.plotting import curdoc [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 
開發者ID:mpi-sws-rse,項目名稱:thingflow-python,代碼行數:23,代碼來源:bokeh.py

示例2: main

# 需要導入模塊: from bokeh import plotting [as 別名]
# 或者: from bokeh.plotting import curdoc [as 別名]
def main():
    viewer = Viewer()
    data = viewer.get_data()
    layout = viewer.create_ui(data)
    curdoc().add_root(layout)
    #partial_update = partial(update, viewer=viewer)
    #curdoc().add_periodic_callback(partial_update, 500) 
開發者ID:osssanitizer,項目名稱:osspolice,代碼行數:9,代碼來源:view.py

示例3: make_fig

# 需要導入模塊: from bokeh import plotting [as 別名]
# 或者: from bokeh.plotting import curdoc [as 別名]
def make_fig(self, plot_source):
        plot_specs = plot_source['plot_specs']
        p = figure(plot_height=400, tools=TOOLS, y_axis_location='left', title=plot_specs.name)
        p.xaxis.axis_label = plot_specs.x_axis_label 
        p.yaxis.axis_label = plot_specs.y_axis_label 

        p.x_range.follow = "end"
        p.x_range.follow_interval = 10
        p.x_range.range_padding = 0 
        # p.xaxis.formatter=DatetimeTickFormatter(dict(seconds=["%S"],minutes=["%M"],hours=["%d %B %Y"],days=["%d %B %Y"],months=["%d %B %Y"],years=["%d %B %Y"]))
        p.xaxis.major_label_orientation = pi/4
        p.line(x=plot_specs.x_axis_label, y=plot_specs.y_axis_label, color="blue", source=plot_specs.source)
        p.circle(x=plot_specs.x_axis_label, y=plot_specs.y_axis_label, color="red", source=plot_specs.source)
        curdoc().add_periodic_callback(functools.partial(self.update, name=plot_specs.name), plot_specs.update_period) #period in ms
        return p 
開發者ID:mpi-sws-rse,項目名稱:thingflow-python,代碼行數:17,代碼來源:bokeh.py

示例4: view

# 需要導入模塊: from bokeh import plotting [as 別名]
# 或者: from bokeh.plotting import curdoc [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) 
開發者ID:histogrammar,項目名稱:histogrammar-python,代碼行數:10,代碼來源:bokeh.py

示例5: create_figure

# 需要導入模塊: from bokeh import plotting [as 別名]
# 或者: from bokeh.plotting import curdoc [as 別名]
def create_figure():
    # args = curdoc().session_context.request.arguments
    # with open('args.txt', 'w') as the_file:
    #     the_file.write(str(curdoc().session_context.request.arguments['batchid']))
    #     the_file.write(str(args))

    df = select_units()

    xs = df[x.value].values
    ys = df[y.value].values
    df['x'] = xs
    df['y'] = ys

    source.data = df.to_dict(orient='list')

    x_title = x.value.title()
    y_title = y.value.title()

    kw = dict()
    if x.value in discrete:
        kw['x_range'] = sorted(set(xs))
    if y.value in discrete:
        kw['y_range'] = sorted(set(ys))
    # kw['title'] = "%s" % (dir(args))
    kw['title'] = "%s vs %s (%i elements)" % (x_title, y_title, len(df))

    # hover = HoverTool(tooltips=[("Address", "@HostnameIP"), ("Malware", "@Malware"), ("Compromise", "@Compromise")])
    p = figure(plot_width=500, plot_height=500, tools=[BoxSelectTool(), ResetTool()], **kw)
    p.xaxis.axis_label = x_title
    p.yaxis.axis_label = y_title

    if x.value in discrete:
        p.xaxis.major_label_orientation = pd.np.pi / 4

        # c = np.where(pandata["Compromise"] > 0, "orange", "grey")
        # sz = np.where(pandata["Compromise"] > 0, 9 * , "grey")

    p.circle(x='x', y='y', source=source, size=15,
            selection_color="orange", alpha=0.8, nonselection_alpha=0.4, selection_alpha=0.6)

    return p 
開發者ID:CERT-W,項目名稱:certitude,代碼行數:43,代碼來源:crossbokeh.py


注:本文中的bokeh.plotting.curdoc方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。