I'm testing igraph python to plot undirected graph. The problem is that the labels get cuttoff for some reasons. The labels contain spaces, so I had to replace the spaces with underscore.
For examples: If the label is Mike_Jorden then only e_jorde is showing and sometimes ike_jorde.
My input is a csv file formatted as N_Col for examples as an input:
Mike_Jorden Test_2
Test_2 Test_1
Test_1 Mike_Jorden
My code is as follow:
from igraph import *
g = Graph.Read_Ncol("graph.csv", directed=False)
names = g.vs["name"]
# remove double quotes
for i in range(len(names)):
names[i] = names[i][1:-1]
layout = g.layout("kk")
visual_style = {}
visual_style["vertex_shape"] = 'rectangle'
visual_style["vertex_size"] = g.betweenness()
visual_style["layout"] = layout
visual_style["bbox"] = (1000,1000)
visual_style["label_size"] = 20
visual_style["margin"] = 20
visual_style["label_dist"] = 20
visual_style["vertex_label"] = names
plot(g ,"test.pdf",**visual_style)
I tried different layout algorithms but I still get the same issue. Any advice please.