我想更改散景网络图的数据源。但是from_network函数不允许我输入source = new_source。但是,如果单击按钮,是否要更改要更新的网络图的数据源?
#PLOT GRAPH WITH BOKEH SERVER
def update_plot_layout(layout_name, range, source_bar):
plot_degree = figure(title='Knowledge Graph', x_range=range, y_range=range,
tools=['box_select,pan,wheel_zoom,box_zoom,reset'],
toolbar_location="right",
toolbar_sticky=False)
plot_degree.grid.grid_line_color = None
graph = from_networkx(g, layout_name , scale=2, center=(0,0))
# graph.node_renderer.data_source = source
#
graph.node_renderer.glyph = Circle(size=20,
fill_color= 'crimson',
fill_alpha = 0.8, line_color = 'black')
# graph.node_renderer.glyph = Circle(size='node_size',
# fill_color= 'crimson',
# fill_alpha = 0.8, line_color = 'black')
#
graph.edge_renderer.glyph = MultiLine(line_color='gray', line_width=1.5, line_alpha = 0.5)
# plot_degree.add_tools(HoverTool(line_policy='interp', tooltips=[('ID', '@index'),
# ('Degree Centrallity', '@degree_centrality')]))
plot_degree.renderers.append(graph)