I am fighting to create an animated population pyramid, and stumbled into an error on ggplotly.
Let me play with the first example on Intro to animations in ggplot2 and add a couple of dots
library(plotly)
library(ggplot2)
df <- data.frame(
x = c(1,2,2,3,3,4),
y = c(1,2,1,2,3,4),
f = c(1,2,2,3,3,4)
)
p <- ggplot(df, aes(x, y)) +
geom_point(aes(frame = f))
ggplotly(p)
it works, but with bars…
library(plotly)
library(ggplot2)
df <- data.frame(
x = c(1,2,2,3,3,4),
y = c(1,2,1,2,3,4),
f = c(1,2,2,3,3,4)
)
p <- ggplot(df, aes(x, y)) +
geom_col(aes(frame = f))
ggplotly(p)
throws an error. it happens with geom_bar also.