Error in igraph plotting - plot parameter

Hello everyone,

I’m trying to plot a graph with python-igraph, but it insists on a parameter passing error in the plot function. The arguments in question are those of visualization style. Can anybody help me?


Line of code:
visual_style = {}
visual_style[“vertex_size”] = d
visual_style[“vertex_color”] = df[‘color’]
visual_style[“vertex_label”] = df[‘genes’]
visual_style[“edge_width”] = report[‘edge_weight’]
visual_style[“edge_color”] = report[‘color’]
ig.plot (g, “graph.pdf”, ** visual_style)

File “”, line 128, in
ig.plot (g, “graph.pdf”, ** visual_style)
File “/home/lucasmiguel/.local/lib/python3.5/site-packages/igraph/drawing/”, line 486, in plot ()
File “/home/lucasmiguel/.local/lib/python3.5/site-packages/igraph/drawing/”, line 288, in save
self.redraw ()
File “/home/lucasmiguel/.local/lib/python3.5/site-packages/igraph/drawing/”, line 272, in redraw
plotter (ctx, bbox, palette, * args, ** kwds)
File “/home/lucasmiguel/.local/lib/python3.5/site-packages/igraph/”, line 3734, in plot
drawer.draw (self, palette, * args, ** kwds)
File “/home/lucasmiguel/.local/lib/python3.5/site-packages/igraph/drawing/”, line 260, in draw
edge_builder = edge_drawer.VisualEdgeBuilder (, kwds)
File “/home/lucasmiguel/.local/lib/python3.5/site-packages/igraph/drawing/”, line 220, in init
values ​​= self.collect_attributes (attr_spec)
File “/home/lucasmiguel/.local/lib/python3.5/site-packages/igraph/drawing/”, line 286, in collect_attributes
if not result:
File “/usr/local/lib/python3.5/dist-packages/pandas/core/”, line 1573, in nonzero
.format (self .
class . name__))
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool (), a.item (), a.any () or a.all ().

The problem is most likely that df["color"] and/or df["genes"] is a Pandas data frame. (It could be any other attribute of visual_style as well). igraph tries to convert one of these into a Boolean in igraph/drawing/, but Pandas data series and NumPy arrays cannot simply be cast to a boolean. The easiest workaround is to ensure that all the values in visual_style are lists and to convert them to lists if they aren’t.