Open floklimm opened 4 years ago
thank you for this example! I'm doing this in a similar way when needed. Only I'm using the property color
instead of group
. e.g.
FBC = FB.copy()
for n in FB.nodes(data=False):
_col = '#%02x%02x%02x' % tuple(list([int(255*_) for _ in degree_scale[n][:3]]))
FBC.node[n]['color'] = _col
I guess we should mention that in the docs, doesn't seem to be in there.
Thanks, that is even easier!
Yes, it would be great if there would be a full list of all properties that can be given to Netwulf in the documentation.
This is not really a bug but rather a workaround that I wanted to make available for others (and maybe you want to integrate it at some point into the library itself).
I wanted to color all nodes by a node property. It is possible to achieve this by using the coloring by `group'. One only has to assign each node an html color according to its value.
Below I give a minimal example that colors a Barabasi-Albert network by node degree.
The result is this image (where nodes are also sized proportionally to their degree). I choose the RGB color to be (X,0,20), such that it is from dark blue to red but this can be adapted as needed. Probably one could also automatically use an existing colormap.
Let me know if there is an easier way to achieve this; anyways, I thought that could be useful for other users.