Add a range figure to the chart.

fig_range(
  g,
  ...,
  type = c("interval", "area"),
  sync = TRUE,
  data = NULL,
  inherit_asp = TRUE,
  alias = "range"
)

Arguments

g

An object of class g2r or g2Proxy as returned by g2() or g2_proxy().

...

Options to pass to the figure, including asp(), and adjust(), active(), selected(), and config(), other key value pairs of are passed to style.

type

Type of figure to use.

sync

Whether to sync the axis data (align) with that used in other figures, set to FALSE to not sync or set to a character string to use as name of sync group.

data

A dataset (data.frame or tibble) to use to draw the figure.

inherit_asp

Whether to inherit the aspects paseed to g2() initialisation function.

alias

Name of the range to display on tooltips, labels, etc.

Details

Requires the ymin and ymax aspects.

Examples

df <- data.frame(
  x = 1:100,
  ymin = runif(100, 1, 5),
  ymax = runif(100, 6, 13)
)

g2(df, asp(x, ymin = ymin, ymax = ymax)) %>%
  fig_range()