graphbgp.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:pyability 作者: syedur-rahman 项目源码 文件源码
def graph_bgp(label_dict, redundancy_counts, x_ticks):
    """ graph bgp
    the main graphing function used to graph the given dataset
    we will be graphing this two ways - full and downsampled
    for computers that cannot handle the full graph, please use the downsampled
    data set in order to see the graph without hassle """

    # define output html file
    output_file("bgpgraph.html")

    # define the figure initial parameters
    p = figure(
        title="INTERNET'S REDUNDANCY", # title
        toolbar_location="above",  # toolbar location
        sizing_mode='stretch_both',  # sizing parameters of the graph
        output_backend="webgl", # allows us to utilize webgl to reduce load
        )

    # draw circles with size 1, color navy, and semi transparent for each datapoint
    p.circle(x_ticks, redundancy_counts, size=1, color="navy", alpha=0.5)

    # x axis label
    p.xaxis.axis_label = 'IPv4 Routes'

    # y axis label
    p.yaxis.axis_label = 'AVAILABLE REDUNDANT PATHS'

    # this allows us to replace our x_ticks with real labels - ip routes
    p.xaxis.formatter = FuncTickFormatter(code="""
        var labels = %s;
        return labels[tick];
        """ % label_dict)

    # displays graph on default browser
    show(p)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号