I'm using IBM Watson Studio as a cloud service, jupyter notebook, Python 3.9, and trying to render a network diagram using the PyVis library. The code works / no errors, but the graph / html will not render, and returns 'Error: 404 Not Found' and 'openresty'
I am using the 'notebook=True' option which should render it in the notebook. Any help on how to render the graph / image / html within Watson Studio Notebook environment (server based)?
The following code executes (taken from the PyVis tutorial), but does not render the graph / image in a Watson Studio Notebook.
from pyvis.network import Network
import pandas as pd
got_net = Network(height='750px', width='100%', bgcolor='#222222', font_color='white', notebook=True)
# set the physics layout of the network
got_net.barnes_hut()
got_data = pd.read_csv('https://www.macalester.edu/~abeverid/data/stormofswords.csv')
sources = got_data['Source']
targets = got_data['Target']
weights = got_data['Weight']
edge_data = zip(sources, targets, weights)
for e in edge_data:
src = e[0]
dst = e[1]
w = e[2]
got_net.add_node(src, src, title=src)
got_net.add_node(dst, dst, title=dst)
got_net.add_edge(src, dst, value=w)
neighbor_map = got_net.get_adj_list()
# add neighbor data to node hover data
for node in got_net.nodes:
node['title'] += ' Neighbors:<br>' + '<br>'.join(neighbor_map[node['id']])
node['value'] = len(neighbor_map[node['id']])
got_net.show('gameofthrones.html')