This function splits the [-1,1] interval into 2000 smaller ones and matches each value of the diff vector to a specific hex color code, using a spline interpolation of the colors as defined in the col parameter.

get_node_colors(net, diff, col)

Arguments

net

an igraph graph object with the node names defined in V(net)$name

diff

numeric vector. Every value is in the [-1,1] interval and represents the average activity difference of each node. The node names have to be specified in the names attribute of the given diff vector and have to be the same as in V(net)$name.

col

a character vector of colors to do the color interpolation in the [-1,1] interval. Usually a two-element vector specifying the colors matching the start and end of the interval (-1 and 1 respectively) or a three-element vector specifying the colors matching the values -1, 0 and 1 (can be more of course, you get the idea).

Value

a character vector of hex color codes where the names attribute corresponds to the nodes of the given igraph object. Will be used to fill in the V(net)$color property of the net object. If there are nodes that are part of the network object net but not present in the diff vector, then a NA value will be given for the color of these nodes.