Show Bokeh and Pyvis plots
Python
Bokeh (docs)
from IPython.display import HTML
from bokeh.embed import file_html
from bokeh.resources import CDN
def display_bokeh(bokeh_figure):
return HTML(file_html(bokeh_figure, CDN))
Pyvis (docs)
# IMPORTS
from IPython.display import HTML
from pyvis import network as net
import networkx as nx
def display_pyvis(pyvis_graph, name):
filename = f"{name}.html"
pyvis_graph.save_graph(filename)
return HTML(filename=filename)
g = net.Network(notebook=True, cdn_resources='in_line')
nxg = nx.complete_graph(5)
g.from_nx(nxg)
display_pyvis(g, "pyvis-example")Last updated
Was this helpful?