I use pyvis to visualize graphs. Everything works well, except for the fact that the node labels are super small, and I need to perform extreme zoom-in in order to see them (see the screenshot)
Is there a way to make the node labels much larger?
Here's a minimal example:
import networkx as nx
GG = nx.gnp_random_graph(100, 0.02, directed=True)
for n in GG.nodes:
GG.nodes[n]["label"] = f"Node {n:03d}"
g = Network(cdn_resources="in_line", notebook=True)
g.toggle_physics(True)
g.toggle_hide_edges_on_drag(True)
g.force_atlas_2based()
g.from_nx(GG)
g.show("graph.html")
!open graph.html
Here how I increase the size of the label:
I follow the tricks given in the pyvis documentation by showing the all interactive button with the
g.show_buttons()
function, choosing the one that fits the needs and generate the options.If you set some option by code (like the
toggle_physics
one), put the call toset_options
after otherwise it will fail with the following error: