Does anyone know of a good walkthrough to visualize a network (from igraph) as it evolves (i.e., new connections are made)? I've looked here on https://www.r-graph-gallery.com/network/ and searched online but haven't seen anything.
For example, if the network is:
library("tidyverse")
library("igraph")
net.bg <- sample_pa(20)
V(net.bg)$size <- 8
V(net.bg)$label <- ""
E(net.bg)$arrow.mode <- 0
net.bg.df <- igraph::as_data_frame(net.bg)
net.bg.df <- net.bg.df %>%
mutate(time_frame = 1:n())
l <- layout_randomly(net.bg)
plot(net.bg, layout=l)
Is there a way to transition the animation by the field time_frame
similar to a normal plot animation like:
library(ggplot2)
library(gganimate)
library(gapminder)
theme_set(theme_bw())
p <- ggplot(
gapminder,
aes(x = gdpPercap, y=lifeExp, size = pop, colour = country)
) +
geom_point(show.legend = FALSE, alpha = 0.7) +
scale_color_viridis_d() +
scale_size(range = c(2, 12)) +
scale_x_log10() +
labs(x = "GDP per capita", y = "Life expectancy")
p + transition_time(year) +
labs(title = "Year: {frame_time}")
Thank you.