Home > Net >  ggraph make filled arrow edges appear in legend
ggraph make filled arrow edges appear in legend

Time:05-30

I'm trying to make a genealogy diagram of the history of EDA, coloring the edges and arrows by the Institution of the PhD degree. This sort of works, but the filled arrow heads in the diagram appear unfilled in the legend. Is there some way to get what I want?

Here's my MWE:

library(readxl)   # Read Excel Files
library(dplyr)    # A Grammar of Data Manipulation
library(here)     # A Simpler Way to Find Your Files
library(ggraph)   # An Implementation of Grammar of Graphics for Graphs and Networks
library(igraph)   # Network Analysis and Visualization

EDA_geneaology <- read_excel(here("EDA-geneaology.xlsx"))

EDA_gen <- EDA_geneaology %>%
  rename(parent = advisor, 
         child = student,
         Institution = institution) 

#' Clean up some links not to be shown
EDA_gen <- EDA_gen %>% 
  mutate(main = (child %in% c("John Tukey", "Harold Gulliksen")) ) %>% 
  filter( !(parent %in% c("Solomon Lefschetz", "James Angell")) ) %>% 
  filter( !(child %in% c("Clyde Coombs")))

EDA_graph <- graph_from_data_frame(EDA_gen[,c(1,3,2,4,6)])


ggraph(EDA_graph, layout="kk")   
  geom_edge_link(aes(color=Institution, fill=Institution),
                 arrow = grid::arrow(type = "closed", 
                                     angle=15, 
                                     length = unit(0.15, "inches"))
                )   
  geom_node_point()  
  geom_node_text(aes(label = name), repel = TRUE)  
  ggtitle("Specimen of a Chart of Geneaology of EDA")   
  theme_graph()  
  theme(legend.position = 'bottom') 

And this is my graph:

enter image description here

Edit

Here is the data: As a link: enter image description here

  • Related