3

I'm trying to animate a time-series of ternary plots made with ggtern. I'd like to animate the 'time' variable but am getting the error

Error: Mapping must have 3 unique named variable pairs

# Get ternary data:
df=data.frame(x=c(.7,.1,.3),
                y=c(.1,.8,.2),
                z=c(.2,.1,.5), time = c(1,2,3))

# Plot with each time as a facet
ggtern::ggtern(data=df,
               aes(x=x,y=y,z=z))+
  geom_point()+
  facet_wrap( ~time)

# Animate
ggtern::ggtern(data=df,
               aes(x=x,y=y,z=z))+
  geom_point()+
  gganimate::transition_time(time)

I'm pretty sure the error is being thrown from ggtern, but not sure how to make it compatible with gganimate. I can't find much in the documentation to figure it out.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
smm
  • 75
  • 4

0 Answers0