Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 206235

how to color the nodes and labels in ggraph

$
0
0

How to specify the color of the edge in ggraph plot like this

library(ggraph)
library(igraph)
df_school = highschool %>% mutate(yr=ifelse(year%%2==0,'purple','blue'))
V(graph)$node_label = names(V(graph))
ggraph(graph, layout = 'linear', circular = TRUE) + 
  geom_edge_arc(aes(colour = factor(year))) + 
  geom_node_label(aes(label=node_label), alpha=0.2) + 
  scale_edge_colour_identity() 

Here only the edge is colored, but I don't know how to code the nodes or labels, or make the label background semi-transparent. Wondering if anyone can help.


Viewing all articles
Browse latest Browse all 206235

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>