Colorize igraph edges using node colors

color_edges_by_nodes(
  g,
  edge_alpha = NULL,
  Crange = c(0, 100),
  Lrange = c(0, 65),
  ...
)

Arguments

g

igraph object that contains vertex node attribute "color" as seen with igraph::vertex_attr(g, "color").

edge_alpha

numeric or NULL, where numeric value sets the edge alpha transparency, where edge_alpha=0 is completely transparent, edge_alpha=0.5 is 50% transparent, and edge_alpha=1 is completely not transparent, and is opaque. When edge_alpha=NULL the alpha values are supplied by colorjam::blend_colors() which blends the two values.

...

additional arguments are passed to colorjam::blend_colors().

Value

igraph object with edge color attribute updated to represent the result of blending node colors, seen by igraph::edge_attr(g)$color.

Details

This function colorizes edges by blending colors for the nodes involved, by calling colorjam::blend_colors().

The color for each node depends upon the node shape, so the color or colors used to render each node shape will be used for the edge. For example:

  • shape="pie" uses the average color from V(g)$pie.color

  • shape="coloredrectangle" uses the avereage color from V(g)$coloredrect.color

  • everything else uses V(g)$color