View source: R/inventory_plot.R
inventory_plot | R Documentation |
Returns an inventory plot using ggplot2
that displays
whether a value is observed or missing for each element and station given.
Takes a data frame as an input and the relevant columns to create the plot.
inventory_plot(
data,
date_time,
elements,
station = NULL,
year = NULL,
doy = NULL,
year_doy_plot = FALSE,
facet_by = NULL,
facet_x_size = 7,
facet_y_size = 11,
title = "Inventory Plot",
plot_title_size = NULL,
plot_title_hjust = 0.5,
x_title = NULL,
y_title = NULL,
x_scale_from = NULL,
x_scale_to = NULL,
x_scale_by = NULL,
y_date_format = NULL,
y_date_scale_by = NULL,
y_date_scale_step = 1,
facet_scales = "fixed",
facet_dir = "h",
facet_x_margin = ggplot2::margin(1, 0, 1, 0),
facet_y_margin = ggplot2::margin(1, 0, 1, 0),
facet_nrow = NULL,
facet_ncol = NULL,
missing_colour = "red",
present_colour = "grey",
missing_label = "Missing",
present_label = "Present",
display_rain_days = FALSE,
rain = NULL,
rain_cats = list(breaks = c(0, 0.85, Inf), labels = c("Dry", "Rain"), key_colours =
c("tan3", "blue")),
coord_flip = FALSE
)
data |
|
date_time |
|
elements |
|
station |
|
year |
|
doy |
|
year_doy_plot |
|
facet_by |
|
facet_x_size |
|
facet_y_size |
|
title |
|
plot_title_size |
|
plot_title_hjust |
|
x_title |
|
y_title |
|
x_scale_from |
|
x_scale_to |
|
x_scale_by |
|
y_date_format |
TODO |
y_date_scale_by |
TODO |
y_date_scale_step |
TODO |
facet_scales |
|
facet_dir |
TODO |
facet_x_margin |
|
facet_y_margin |
|
facet_nrow |
|
facet_ncol |
|
missing_colour |
|
present_colour |
|
missing_label |
|
present_label |
|
display_rain_days |
|
rain |
|
rain_cats |
TODO |
coord_flip |
|
labels |
|
key_colours |
|
A plot of type ggplot
to the default plot device
# Create an inventory plot with two elements and by station.
data(daily_niger)
inventory_plot(data = daily_niger, station = "station_name", elements = c("tmax", "tmin"),
date_time = "date")
# Create an inventory plot by year and day of year
inventory_plot(data = daily_niger, station = "station_name", elements = c("tmax", "tmin"),
date_time = "date", year_doy_plot = TRUE)
# Can add in rainy/dry days into the plot
inventory_plot(data = daily_niger, station = "station_name", elements = c("tmax", "tmin"),
date_time = "date", rain = "rain", display_rain_days = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.