Hi everyone
I was trying to use igraph to generate a network with variant edge width, so I tried one example with tutorial example. Here is the link: Quick Start
However, this tutorial is not working on my environment. I removed the edge_width and edge_color in ig.plot() then it works and plotted something, of course, without variances in edge width. I don’t know whether there is anything wrong on my python environment. I have attached the tarceback here.
Thanks so much for help!
Here is the traceback:
For edge_width:
Traceback (most recent call last):
File "H:/my/code folder/nonvVisualisation/testing/network_igraph.py", line 130, in <module>
__demo_quickstart()
File "H:/my/code folder/nonvVisualisation/testing/network_igraph.py", line 110, in __demo_quickstart
edge_width=[7 if married else 1 for married in g.es["married"]],
File "C:\Users\zuhuh\AppData\Local\Programs\Python\Python37\lib\site-packages\igraph\drawing\__init__.py", line 475, in plot
result.draw(obj, *args, **kwds)
File "C:\Users\zuhuh\AppData\Local\Programs\Python\Python37\lib\site-packages\igraph\drawing\graph.py", line 1351, in draw
zorder=ezorder[ie],
File "C:\Users\zuhuh\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\patches.py", line 4116, in __init__
Patch.__init__(self, **kwargs)
File "C:\Users\zuhuh\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\patches.py", line 103, in __init__
self.update(kwargs)
File "C:\Users\zuhuh\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\artist.py", line 888, in update
for k, v in props.items()]
File "C:\Users\zuhuh\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\artist.py", line 888, in <listcomp>
for k, v in props.items()]
File "C:\Users\zuhuh\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\artist.py", line 882, in _update_property
return func(v)
File "C:\Users\zuhuh\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\patches.py", line 371, in set_lw
return self.set_linewidth(lw)
File "C:\Users\zuhuh\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\patches.py", line 362, in set_linewidth
self._linewidth = float(w)
TypeError: float() argument must be a string or a number, not 'list'
For edge_color:
Traceback (most recent call last):
File "C:\Users\zuhuh\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\colors.py", line 169, in to_rgba
rgba = _colors_full_map.cache[c, alpha]
TypeError: unhashable type: 'list'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "H:/my/code folder/nonvVisualisation/testing/network_igraph.py", line 130, in <module>
__demo_quickstart()
File "H:/my/code folder/nonvVisualisation/testing/network_igraph.py", line 111, in __demo_quickstart
edge_color=["#7142cf" if married else "#AAA" for married in g.es["married"]]
File "C:\Users\zuhuh\AppData\Local\Programs\Python\Python37\lib\site-packages\igraph\drawing\__init__.py", line 475, in plot
result.draw(obj, *args, **kwds)
File "C:\Users\zuhuh\AppData\Local\Programs\Python\Python37\lib\site-packages\igraph\drawing\graph.py", line 1351, in draw
zorder=ezorder[ie],
File "C:\Users\zuhuh\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\patches.py", line 4116, in __init__
Patch.__init__(self, **kwargs)
File "C:\Users\zuhuh\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\patches.py", line 85, in __init__
self.set_color(color)
File "C:\Users\zuhuh\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\patches.py", line 332, in set_color
self.set_facecolor(c)
File "C:\Users\zuhuh\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\patches.py", line 315, in set_facecolor
self._set_facecolor(color)
File "C:\Users\zuhuh\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\patches.py", line 305, in _set_facecolor
self._facecolor = colors.to_rgba(color, alpha)
File "C:\Users\zuhuh\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\colors.py", line 171, in to_rgba
rgba = _to_rgba_no_colorcycle(c, alpha)
File "C:\Users\zuhuh\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\colors.py", line 222, in _to_rgba_no_colorcycle
raise ValueError("Invalid RGBA argument: {!r}".format(orig_c))
ValueError: Invalid RGBA argument: ['#7142cf', '#AAA', '#AAA', '#AAA', '#AAA', '#AAA', '#AAA', '#7142cf']
Process finished with exit code 1