coordinates <- c(48.521637, 9.057645)
#adding photoperiods to a ggplot
sample.data.environment |>
gg_days() |>
gg_photoperiod(coordinates)
#adding photoperiods prior to plotting
sample.data.environment |>
add_photoperiod(coordinates, solarDep = 0) |>
gg_days() |>
gg_photoperiod()
#more examples that are not executed for computation time:
# \donttest{
#plotting photoperiods automatically works for both gg_day() and gg_days()
sample.data.environment |>
gg_day() |>
gg_photoperiod(coordinates)
#plotting for gg_doubleplot mostly works fine
sample.data.environment |>
filter_Date(length = "2 days") |>
gg_doubleplot() |>
gg_photoperiod(coordinates)
#however, in cases where only one day of data per group is available, or the
#type = "repeat" setting is used, the photoperiods need to be added
#separately. Otherwise the second day will be off by one day in each panel.
#The visual difference is subtle, and might not be visible at all, as
#photoperiod only every changes by few minutes per day.
#WRONG
sample.data.environment |>
filter_Date(length = "1 days") |>
gg_doubleplot() |>
gg_photoperiod(coordinates)
#CORRECT
sample.data.environment |>
filter_Date(length = "1 days") |>
add_photoperiod(coordinates) |>
gg_doubleplot() |>
gg_photoperiod()
# }
Run the code above in your browser using DataLab