AnnotateDaylight {gghourglass} | R Documentation |
Annotate ggplot with a band indicating solar events
Description
Annotate a ggplot (currently only plots using coord_hourglass()
is supported) with a coloured band indicating solar events, such
as sunset and sunrise.
Usage
AnnotateDaylight
annotate_daylight(
longitude = 0,
latitude = 60,
sun_prop = c("sunrise", "sunset"),
...
)
Arguments
longitude , latitude |
Geographical location that will be used to calculate sunlight times. |
sun_prop |
A vector of two solar events that should be
captured by the annotation. It will be shown as a coloured band
between these two events. Default is |
... |
Passed to the list of layer parameters. |
Format
An object of class AnnotateDaylight
(inherits from GeomPolygon
, Geom
, ggproto
, gg
) of length 6.
Value
Returns a ggplot2::layer()
which can be added to a ggplot2::ggplot()
Author(s)
Pepijn de Vries
Examples
library(ggplot2)
data(bats)
monitoring <- attr(bats, "monitoring")
ggplot(subset(bats, format(RECDATETIME, "%Y") == "2018"),
aes(x = RECDATETIME, col = SPECDESCSCI)) +
annotate_daylight(monitoring$longitude[1], monitoring$latitude[1], c("sunset", "sunrise")) +
annotate_daylight(monitoring$longitude[1], monitoring$latitude[1], c("dusk", "dawn")) +
geom_hourglass()
[Package gghourglass version 0.0.3 Index]