create_climograph.Rd
Given weather data from weatherOz, create a climograph with maximum and minimum temperature on the left-hand y-axis and precipitation on the right- hand y-axis. The colours used are DPIRD's dark red (tmax), light blue (tmin) and dark blue (rain).
create_climograph(weather)
A data.frame
containing weather station data from the
SILO or DPIRD "Weather-2.0" APIs as provided
by weatherOz.
A ggplot2 object.
library(weatherOz)
wd <- get_dpird_summaries(
station_code = "BI",
start_date = "20220101",
end_date = "20221231",
api_key = Sys.getenv("DPIRD_API_KEY"),
interval = "daily",
values = c(
"airTemperatureMin",
"airTemperatureMax",
"rainfall"
)
)
# create the {ggplot2} object
c_graph <- create_climograph(wd)
# add a title, subtitle and caption
library(ggplot2)
main <- "Binnu Weather for 2022"
sub <-
"Precipitation (left y-axis) and Min and Max Temperature (right y-axis)"
cap <-
"Data from DPIRD Weather 2.0 API"
c_graph +
labs(
title = main,
subtitle = sub,
caption = cap
)
#> Warning: Removed 13 rows containing missing values (`position_stack()`).