Hi Everyone I was wondering if i can get some help with gganimate and package sf please. I have created code that works in principle but not exactly what i want as output. See below:
wpg_animation <- ggplot(obj1$geometry) +
geom_sf(color = "black", fill = "lightgreen") +
xlab("Longitude") + ylab("Latitude") +
annotation_scale(location = "br", width_hint = 0.5) +
theme(panel.grid.major = element_line(color = "white", linetype = "dashed", size = 0.5)) +
## gganimate part
labs(title = 'Elevation: {closest_state}') +
transition_states(obj1$Elevation,
transition_length=.5,
state_length=2) +
ease_aes("linear")
the output is as follows
Now my problems are as follows, along with desired outcome states:
- its not outputting the entire city geometry - i wish for the city geometry to stay in the background
- I wanted to create another variable (called flooding perhaps) in that if water level is greater than elevation level in the neighbourhood centroid then that neighbourhood polygon turns blue (not green)
- how do you control the amount of *.png files gganimate creates? because really i just want 1 png file per elevation level.
any help appreciated!
take care!