# load and manipulate data
data("starwars")
sw1 <- starwars[[1]]
sw_palette <- c("#1A5878", "#C44237", "#AD8941", "#E99093", "#50594B")
V(sw1)$interactions <- graph.strength(sw1)
#plot
ggraph(graph = sw1,layout = "stress") +
geom_edge_link0(edge_colour = "grey25",
aes(edge_linewidth = weight)) +
geom_node_point(shape = 21, color = "black",stroke = 1,
aes(fill = sex,size = interactions)) +
geom_node_text(color = "black", size = 4, repel = FALSE,
aes(filter = (interactions>=65),label = name))+
scale_edge_width(range = c(0.1,1.5),guide = "none")+
scale_size(range = c(3,10),guide = "none")+
scale_fill_manual(values = sw_palette, na.value = "grey",name = "")+
coord_fixed()+
theme_graph() +
theme(legend.position = "bottom") +
guides(fill = guide_legend(override.aes = list(size=6)))