Node color and size
p1 <- p + geom_point(size=6, color='steelblue')
p2 <- p + geom_point(aes(color = label %in% letters[1:5]), size=6)
p3 <- p + geom_point(aes(size = igraph::degree(net)), color='steelblue')
p4 <- p + geom_point(aes(shape = label %in% letters[1:5]), color='steelblue', size=8)
plot_list(p1, p2, p3, p4, ncol=2)
Network with pies
flow_info <- data.frame(from = LETTERS[c(1,2,3,3,4,5,6)],
to = LETTERS[c(5,5,5,6,7,6,7)])
dd <- data.frame(
label = LETTERS[1:7],
v1 = abs(rnorm(7)),
v2 = abs(rnorm(7)),
v3 = abs(rnorm(7))
)
g <- igraph::graph_from_data_frame(flow_info)
p <- ggplot(g) + geom_edge()
library(scatterpie)
## scatterpie v0.2.4 Learn more at https://yulab-smu.top/
##
## Please cite:
##
## D Wang, G Chen, L Li, S Wen, Z Xie, X Luo, L Zhan, S Xu, J Li, R
## Wang, Q Wang, G Yu. Reducing language barriers, promoting information
## absorption, and communication using fanyi. Chinese Medical Journal. 2024,
## 137(16):1950-1956. doi: 10.1097/CM9.0000000000003242
p %<+% dd +
geom_scatterpie(cols = c("v1", "v2", "v3")) +
geom_text(aes(label=label), nudge_y = .2) +
coord_fixed()