I am using plotly in R to animate markers that should be plotted in front of a polygon. However, the markers move behind the polygon every other frame. I can set
redraw = TRUE , but the markers still blink. Is there a way to stop this from happening?
A reproducible example where the markers are stationary but change size each frame:
set.seed(1002) dat.polygon = data.frame(x = c(0,0,1,1), y = c(0,1,1,0)) dat.marker = data.frame(id = rep(seq_len(5), 10), x = rep(runif(5, 0, 1), 10) , y = rep(runif(5, 0, 1), 10), f = rep(seq_len(10), each = 5), r = runif(50, 1, 10)) plot_ly(x = ~x, y = ~y) %>% add_polygons(data = dat.polygon, alpha = I(1)) %>% add_markers(data = dat.marker, frame = ~f, ids = ~id, size = ~r) %>% animation_opts(frame = 1000, transition = 500, redraw = FALSE)