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)
评论列表
文章目录