I would like to change the color of nodes within the column A
:
A B Score Value
0 user1 test1 6.6 A
1 user1 user241 3.2 AA
2 user241 test1 4.8 B
3 user12 test4 3.1 C
4 user1 user23 2.9 A
To create the network I am using mnet:
from pymnet import *
import matplotlib.pyplot as plt
mnet = MultilayerNetwork(aspects=1)
for index in df.index:
mnet[df.loc[index, 'A'], df.loc[index, 'B'],'friendship','friendship'] = 1
fig=draw(mnet, show=True, figsize=(25,30))
I think I should change the color within draw()
, but I do not not the command. No matter which color should be used, as what it is important is that all the users in A
can have the same color (different from that in B
). Some user within A
may be also in B
.
I would do something like this:
for node in mnet:
if node in df["A"].values:
colors.append("red")
else: colors.append("green")
But I do not know how to add such info in fig
.