if (FALSE) {
library(igraphdata)
data(foodwebs)
fw <- foodwebs[[1]] %>%
induced_subgraph(V(.)[ECO == 1]) %>%
add_layout_(with_fr()) %>%
set_vertex_attr("label", value = seq_len(gorder(.))) %>%
set_vertex_attr("size", value = 10) %>%
set_edge_attr("arrow.size", value = 0.3)
V(fw)$color <- scales::dscale(V(fw)$Biomass %>% cut(10), diverging_pal)
plot(fw)
data(karate)
karate <- karate %>%
add_layout_(with_kk()) %>%
set_vertex_attr("size", value = 10)
V(karate)$color <- scales::dscale(degree(karate) %>% cut(5), diverging_pal)
plot(karate)
}
Run the code above in your browser using DataLab