Reputation: 1102
from pyvis.network import Network
# import pyvis
# pyvis.options.Layout(randomSeed=None, improvedLayout=True)
g = Network()
g.show_buttons(filter_= ['configure','layout','interaction','physics','edges'])
g.add_node(0,image ="https://www.w3schools.com/w3css/img_lights.jpg")
g.add_node(1)
g.add_node(2,label="Node 2",image="https://www.w3schools.com/w3css/img_lights.jpg")
g.add_node(3)
g.add_node(4)
g.add_node(5)
g.add_edge(0, 1)
g.show("basic.html")
I tried this code, it is not working for me and also I need your suggestion which is best package to do social network graph in python and javascript.
Upvotes: 2
Views: 4327
Reputation: 61
You need to set the shape of the node to 'image' or 'circularImage'.
For instance:
g.add_node(0, shape='image', image ="https://www.w3schools.com/w3css/img_lights.jpg")
Upvotes: 6