I am trying to use ggplotly
to animate some points through time. The time intervals are of variable length, however, and it seems that plotly's default behavior is to set equal spacing on the animation slider for each given frame. This is undesirable, as the constant spacing misrepresents the duration of time in the dataset.
I haven't been able to figure out whether there is any way to change this. Is it possible to customize the spacing between steps on the animation slider—and, perhaps, the duration between each step?
Simple example:
x <- tribble(
~x, ~y, ~t,
1, 1, 1,
2, 2, 2,
4, 4, 4
)
g <- ggplot(x, aes(x, y)) +
geom_point(aes(frame=t))
ggplotly(g)
Output image In this example, time 4 is just as close to time 2 as 2 is to 1.
The best workaround-ish I can think of right now is to duplicate data in all the right places to synthetically ensure that there actually is equal spacing between times/frames. This is still suboptimal, since then it would make the data appear to jump unrealistically every time the frame transitions from a synthetic time to an observed one.