Skip to contents

Generates a bar plot illustrating the total monthly precipitation across multiple weather stations.

Usage

monthly_precipitation_plot(
  ...,
  colors = NULL,
  title = "Accumulated Precipitation by Month"
)

Arguments

...

One or more data frames, each containing data for a weather station. Each data frame must include the following columns:

  • fecha Date of the precipitation measurement. Should be in a format coercible to Date.

  • id Identifier for the weather station.

  • precipitacion_pluviometrica Numeric value representing the precipitation in millimeters.

You can pass multiple data frames separated by commas, e.g., "station1", "station2", "station3"

colors

Optional. A character vector specifying the colors to use for each station in the plot. If not provided, the function will generate a set of dark colors automatically. The vector should either be named with station IDs or have a length matching the number of stations.

title

Optional. A string specifying the title of the plot. Defaults to "Accumulated Precipitation by Month".

Value

A ggplot object representing the total monthly precipitation for each station.

Details

This function accepts one or more data frames, each representing data from a different weather station. It aggregates the monthly precipitation data and visualizes it using a grouped bar chart. Users can customize the plot colors and title as needed.

See also

goatR::download_datasets for downloading datasets from Argentine weather stations, and goatR::read_datasets for reading the downloaded datasets into R.

Examples

if (FALSE) { # \dontrun{
# Assuming you have two data frames: station1 and station2
plot <- monthly_precipitation_plot(station1, station2, title = "Monthly Precipitation")
print(plot)
} # }