| ggwindrose | R Documentation |
Plot a windrose showing the wind speed and direction using ggplot2.
ggwindrose(
speed,
direction,
n_directions = 8,
n_speeds = 5,
speed_cuts = NA,
col_pal = "GnBu",
legend_title = "Wind speed (m/s)",
calm_wind = 0,
n_col = 1,
facet = NULL,
plot_title = "",
stack_reverse = FALSE,
...
)
speed |
Numeric vector of wind speeds. |
direction |
Numeric vector of wind directions. |
n_directions |
Numeric value with the number of direction bins to plot
(petals on the rose). Valid values are |
n_speeds |
Numeric value with the number of equally spaced wind speed
bins to plot. This is used if |
speed_cuts |
Numeric vector with the cut points for the wind speed
intervals, or |
col_pal |
Character string indicating the name of the
|
legend_title |
Character string to be used for the legend title. |
calm_wind |
Numeric value with the upper limit for wind speed that is
considered calm (default |
n_col |
The number of columns of plots (default 1). |
facet |
Character or factor vector of facets used to plot windroses. |
plot_title |
Character string to be used for the plot title. |
stack_reverse |
Logical. If |
... |
Further arguments (ignored). |
A ggplot2 object. See help("ggplot2").
You need to set your API key globally using aemet_api_key().
Query timeout can be controlled with
options(climaemet_timeout = 60) (default value). See
httr2::req_timeout() for details.
ggplot2::theme() for more possible arguments to pass to
ggwindrose().
Plotting functions:
climatestripes_station(),
climatogram_normal(),
climatogram_period(),
ggclimat_walter_lieth(),
ggstripes(),
windrose_days(),
windrose_period()
Wind functions:
climaemet_9434_wind,
windrose_days(),
windrose_period()
library(ggplot2)
speed <- climaemet::climaemet_9434_wind$velmedia
direction <- climaemet::climaemet_9434_wind$dir
rose <- ggwindrose(
speed = speed,
direction = direction,
speed_cuts = seq(0, 16, 4),
legend_title = "Wind speed (m/s)",
calm_wind = 0,
n_col = 1,
plot_title = "Zaragoza Airport"
)
rose + labs(
subtitle = "2000-2020",
caption = "Source: AEMET"
)
# Reverse the stack.
ggwindrose(
speed = speed,
direction = direction,
speed_cuts = seq(0, 16, 4),
legend_title = "Wind speed (m/s)",
calm_wind = 0,
n_col = 1,
plot_title = "Zaragoza Airport",
stack_reverse = TRUE
) +
labs(
subtitle = "2000-2020",
caption = "Source: AEMET"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.