Relative Content

Tag Archive for rigraphggraph

Controlling order in which network edges are drawn in ggraph

My understanding is that ggraph() plots edges in the order in which they appear in the edges data frame of a tidygraph object (or in the edge sequence of an igraph object). So the order in which edges are plotted can be changed by setting/changing the order of edges in the data frame (for example, via dplyr::arrange()) or igraph object. Yet for some reason this is not working with geom_edge_link() in the reprex below. I arrange edges in the original data frame (and resulting igraph and tidygraph objects) so that edges of type "ego.alter" come first. However, they are not drawn first (i.e., underneath all other edges) by ggraph(). Note that they are correctly drawn first by plot.igraph() instead.