Edge colors in both nplot() and set_edge_gpar() can be specified using a formula based on ego() and alter() (source and target). This way the user can set various types of combination varying the mixing of the colors, the alpha levels, and the actual mixing colors to create edge colors.

color_formula(x, col, alpha, env, type, mix = 1, postfix = NULL)

ego(...)

alter(...)

Arguments

x

An object of class netplot.

col

Any valid color. Can be a single color or a vector.

alpha

Number. Alpha levels

env, type, postfix

For internal use only.

mix

Number. For mixing colors between ego and alter

...

Passed to color_formula.

Value

Nothing. These functions are called internally when using formulas. color_formula modifies the environment env.

Examples

if (require(gridExtra) & require(magrittr)) { library(igraph) net <- make_ring(4) set.seed(1) np <- nplot(net, vertex.color = grDevices::hcl.colors(4), vertex.size.range=c(.1, .1)) np %<>% set_edge_gpar(lwd = 4) grid.arrange( np, np %>% set_edge_gpar(col =~ego + alter), np %>% set_edge_gpar(col =~ego(alpha=0) + alter), np %>% set_edge_gpar(col =~ego + alter(alpha=0)), np %>% set_edge_gpar(col =~ego(mix=0) + alter(mix=1)), np %>% set_edge_gpar(col =~ego(mix=1) + alter(mix=0)) ) }
#> Loading required package: gridExtra