Skip to contents

Parameters to add and customize shadeareas in roboplots.

Usage

set_shadearea(
  xmin = NULL,
  xmax = NULL,
  border = getOption("roboplot.colors.traces")[1],
  color = getOption("roboplot.colors.traces")[1],
  opacity = 0.2,
  layer = "between"
)

Arguments

xmin, xmax

Currently not validated. These need to be of the same type as the respective axis for the shade area to work.

border, color

Characters. The color for the shade area. Must be a hexadecimal color or a valid css color.

opacity

Numeric. Controls the opacity of the shade area. Use a value between 0 and 1.

layer

Character. Whether the shade area is above or below the plot traces. Use "above" or "below".

Value

A list of class roboplotr.set_shadearea

Examples

# You can use` shadearea` when the x-axis is numeric or date to highlight areas
# of the plot.
d <- energiantuonti |>
  dplyr::filter(Alue == "Venäjä")
d |> roboplot(Suunta, shadearea = set_shadearea(xmin = "2018-01-01"))
# Use the other parameters to fine-tune the appearance of the `shadearea`. d |> roboplot( Suunta, shadearea = set_shadearea( xmin = "2018-01-01", color = "green", border = "black", opacity = 0.8, layer = "below" ) )