私は、テキスト入力とボタン付きの単純なボケレイアウトでした。ボタンをクリックすると、textinput.valueに応じて、2つのプロットを作成する必要があります。Bokehの複数のプロット
プロット1はネットワークxディグラグラフであり、プロット2は価格の時系列です。ここで私が試したことは次のとおりです。
ask_input = TextInput(placeholder="Search", width = 500, height=100)
ask_button = Button(label="GET", width = 100, height=50)
ask_button.on_click(addPlots)
layout = layout([[widgetbox(ask_input, ask_button)]])
curdoc().add_root(layout)
def addPlots():
p1=buildGraph()
p2=buildPlot()
layout.children[-1].children.append(row([p1],[p2]))
def buildGraph():
for i in range(len(graph_matrix)):
client_graph.add_edge(green_nodes[i], orange_nodes[i], weight=weights[i])
node_size=5000
pos=nx.spring_layout(client_graph)
node_colors = ['green' if node in green_nodes.unique() else 'orange'
for node in client_graph.nodes()]
nx.draw_networkx_edges(client_graph, pos, arrows=True)
nx.draw_networkx_nodes(client_graph, pos,with_labels=True, arrows = True, node_size=node_size, node_color=node_colors)
nx.draw_networkx_labels(client_graph, pos, font_size=15,font_family='CONSOLAS', with_labels=True, arrows=True)
#this is where there maybe a disconnect between the graph and the plot
fig = figure(title='Connections')
return fig
def buildPlot():
fig2=stock_df.plot('adj_close',data=stock_df) #against a DateTimeIndex
return fig2
エラーは、LayoutDOM以外のオブジェクトを行に挿入できないということです。グラフ/プロットを図の右側に追加していないことを確認してください。 networkxグラフをプロットに追加できますか?