Skip to contents

In a funnel area plot, each row of data_frame is represented as a trapezoidal sector of a funnel.

Usage

px_funnel_area(
  data_frame = NULL,
  names = NULL,
  values = NULL,
  color = NULL,
  color_discrete_sequence = NULL,
  color_discrete_map = NULL,
  hover_name = NULL,
  hover_data = NULL,
  custom_data = NULL,
  labels = NULL,
  title = NULL,
  subtitle = NULL,
  template = NULL,
  width = NULL,
  height = NULL,
  opacity = NULL
)

Arguments

data_frame

A data.frame, data.table, list or matrix. Needed for column names to be used in the other arguments; if NULL, a data frame is built from the vectors given in the other arguments.

names

A column name in data_frame, a vector of values, a one-sided formula evaluated in data_frame (e.g. ~ log(pop)), px_constant() or px_range(). Values from this column or vector are used as labels for sectors.

values

A column name in data_frame, a vector of values, a one-sided formula evaluated in data_frame (e.g. ~ log(pop)), px_constant() or px_range(). Values from this column or vector are used to set values associated to sectors.

color

A column name in data_frame, a vector of values, a one-sided formula evaluated in data_frame (e.g. ~ log(pop)), px_constant() or px_range(). Values from this column or vector are used to assign color to marks.

color_discrete_sequence

Character vector of colors, e.g. px_colors$qualitative$Set1. Values of color are assigned colors in order (cycling), unless set in color_discrete_map. Defaults to the template's colorway.

color_discrete_map

Named character vector or list mapping values of color to colors, overriding color_discrete_sequence. If the values of color are colors, px_identity() (or "identity") uses them directly.

hover_name

A column name in data_frame, a vector of values, a one-sided formula evaluated in data_frame (e.g. ~ log(pop)), px_constant() or px_range(). Values from this column or vector appear in bold in the hover tooltip.

hover_data

Extra data to show in the hover tooltip: column names (a character vector or a formula such as ~c(a, b)), or a named list with column names as names and values TRUE (default formatting), FALSE (hide the column, e.g. one shown by default), a d3-format string such as ":.3f", a vector of data, or a list of a format string or TRUE and a vector of data.

custom_data

Column names (a character vector or a formula such as ~c(a, b)), or a list of column names, formulas and vectors. Values from these columns are added to the traces' customdata (e.g. for use in Shiny events) without appearing in the hover tooltip.

labels

Named character vector or list mapping column names to the labels to use for axis titles, legend entries and hover text, e.g. c(gdpPercap = "GDP per capita").

title

The figure title.

subtitle

The figure subtitle.

template

A template name (see template_names()) or a template list. Defaults to default_template().

width

The figure width in pixels.

height

The figure height in pixels.

opacity

Value between 0 and 1. Sets the opacity for markers.

Value

A go_figure().

Examples

data.frame(stage = c("Visit", "Download", "Sign up", "Purchase"),
           number = c(39, 27.4, 20.6, 11)) |>
  px_funnel_area(values = ~number, names = ~stage)