0
我在這個項目中使用jupyter筆記本。現在我的代碼的實現嚴格基於一個叫做OSMnx的API。我需要的圖形直接呈現.html頁面。如何在Python Jupyter中編輯渲染的HTML頁面?
但是,我想編輯.html頁面並添加另一個元素。我怎樣才能做到這一點?
graph = ox.plot_graph_folium(makati, popup_attribute = 'name',edge_width=2)
filepath = 'graph.html' #<-- this is the html page where *graph* is saved
graph.save(filepath)
IFrame(filepath, width=600, height=500) #<-- renders to jupyter
凡HTML身體的一部分只包含此:
<body>
<div class="folium-map" id="map_c37c729e86d64119aec19e0055a1ab04" >
</div>
#I want to add a button element here
</body>
如何訪問文件路徑?
我怎麼可以編輯和添加其他元素(與現有的?
謝謝!
嗨!驚訝的是創造者是一個迴應。是的,其實我只是做到了。但我想知道,如果pythonically可以有一種方式。事情是,圖形生成可能會在程序中再次被請求,因此覆蓋它,除非我pythonically創建一個按鈕單擊後,我想添加的元素將被添加到folium(如graph_route_folium)。這些元素將是節點,而不是尋找路由的nx.shortestpath,我希望它基於我將從葉片中選擇的節點。因此我需要在後端做到這一點。有任何想法嗎? – Reiion