python igraph - vertex labels in ipython notebook -
the vertex labels when plot graph in ipython notebook inline messed up. problem not exist when @ graph.pdf (see code below). not have enough stackoverflow reputation post images here, have pdf file , can send on if interested.
here code snipet:
layout = g.layout("random") visual_style = {} visual_style["vertex_label"] = g.vs["label"] visual_style["vertex_label_size"] = 2 visual_style["vertex_color"] = [color_dict[vert] vert in g.vs["label"]] visual_style["bbox"] = (500,500) visual_style["margin"] = 20 visual_style["layout"] = layout plot(g, 'graph.pdf', **visual_style)
in short, g contains graph, , created using list of vertices , list of edges.
g = graph(vertex_attrs={"label": vertices}, edges=edges, directed=false)
the vertices of g have labels. these labels things like, 'wrl-africa' , 'soc-crime' , 'spo-soccer' , etc.
each label associated color through color_dict follows,
color_dict = {'wrl-africa':'#a52a2a', 'soc-crime':'#006400', 'spo-soccer':'#b22222'}
why happening? seems bounding box issue. in advance help.
Comments
Post a Comment