Relative Content

Tag Archive for rggplot2animationvisualizationgganimate

How to dynamically adjust plot background transparency in ggplot2 based on sunheight?

I’ve created an animated plot in ggplot2 that visualizes the GPS tracks of a diurnal species over time. To improve the visualisation, I would like to overlay a semi-transparent layer that dynamically changes based on whether it is day or night. I don’t want to use static values, but rather use the actual sun height. I’ve supplemented my dataset with the sun positions using the suncalcpackage. A reproducible example with dummy data can be found below. Anyone who can help me in the right direction?