How to create bubble plot with timeline by echarts4r?

49 Views Asked by At

I tried to create a bubble plot with timeline as below:

library(echarts4r)
library(tidyverse)

df<-data.frame(siteid=c(rep(1,3),rep(2,3),rep(3,3)),
           year=rep(c(2001,2005,2010),3),
           population=c(c(10,30,40),c(15,35,50),c(12,40,60)),
           dis=c(c(2,5,10),c(2,0,0),c(0,5,10)))

df |> 
  group_by(year)|> 
  e_charts(population,timeline = TRUE) |>
  e_scatter(dis,population)

However, there was nothing showed up.

In general, I'd like to know how to plot it in the right way. I'd like the bubble size determined by the different values of population and color determined by siteid while making the x and y axis to be stabilized, so that I could see the bubbles growing and moving through the timeline.

0

There are 0 best solutions below