Hi gganimators! I produced a gganimate plot using the following code below.
Note that year
is loaded as double but in fact it is an integer (no decimals). When using {frame_time}
within labs
I would like to have it showing only integers, not all those decimals. How to fix it? I tried to fix it by transforming year
to factor, but then the animation was jumping across frames, not smoothly moving. Also round()
dit not work within frame_time
.
tebu %>%
group_by(year, location, state, efficacy) %>%
summarise(mean_efficacy = mean(efficacy)) %>%
filter(mean_efficacy > 0) %>%
ggplot(aes(year, mean_efficacy,
size = mean_efficacy,
color = mean_efficacy)) +
geom_jitter() +
scale_color_viridis() +
transition_time(year) +
ease_aes('linear')+
exit_fade()+
shadow_trail(max_frames = 5) +
labs(
title = "Effect of tebuconazole for controling soybean rust in Brazil",
subtitle = "Year: {frame_time)}",
x = "Harvest year",
y = "Control efficacy (%)",
caption = "Del Ponte et al. (unpublished)"
) +
theme(legend.position = "none",
axis.text.x = element_text(angle = 45, hjust = 1)) +
facet_wrap(~state)