I don't think this has been addressed here yet. New to R and did my best with the reprex below.
I have a directed network with nodes sized by degree and would like the arrows on the directed edges to contact the nodes, regardless of their size.
I have fiddled with
geom_edge_link() but that adjusts things for all of the nodes in a uniform fashion. I also thought I might be able to balance that with
scale_size_continuous(), but that seems to get me nowhere in a hurry. I also came across this, but I'm wondering (hoping?) if there is a solution "within"
library(tidyverse) library(tidygraph) #> #> Attaching package: 'tidygraph' #> The following object is masked from 'package:stats': #> #> filter library(ggraph) # Creating a data frame df <- rbind(c(0,1,1,0,0,1,1,0,1), c(0,0,1,1,0,0,1,1,0), c(0,1,0,0,0,0,1,0,0), c(0,0,0,0,0,1,0,1,0), c(0,0,1,0,0,1,0,1,0), c(0,0,1,0,0,1,1,1,0), c(1,0,1,1,0,1,0,1,0), c(0,1,0,0,0,0,0,0,1), c(0,1,0,0,0,1,1,0,1)) df <- as_tbl_graph(df) df %>% mutate(centrality = (centrality_degree(mode = "out"))) %>% ggraph(layout = 'kk') + theme_graph()+ #appears that this has to go first scale_size_continuous(range = c(5, 10))+ geom_node_point(aes(size=centrality))+ geom_edge_link(arrow = arrow(angle = 10, length = unit(3, 'mm'), type="closed"), start_cap = circle(5, 'mm'), end_cap = circle(5, 'mm'))+ theme(legend.position = "none")
Created on 2020-07-21 by the reprex package (v0.3.0)