Skip to contents

In a parallel categories (or parallel sets) plot, each row of data_frame is grouped with other rows that share the same values of dimensions and then plotted as a polyline mark through a set of parallel axes, one for each of the dimensions.

Usage

px_parallel_categories(
  data_frame = NULL,
  dimensions = NULL,
  color = NULL,
  labels = NULL,
  color_continuous_scale = NULL,
  range_color = NULL,
  color_continuous_midpoint = NULL,
  title = NULL,
  subtitle = NULL,
  template = NULL,
  width = NULL,
  height = NULL,
  dimensions_max_cardinality = 50
)

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.

dimensions

Column names in data_frame (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 used for multidimensional visualization.

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.

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").

color_continuous_scale

Character vector of colors, e.g. px_colors$sequential$Viridis, or the name of a scale in px_colors. Used when color is numeric. Defaults to the template's sequential colorscale.

range_color

If provided, overrides auto-scaling on the continuous color scale.

color_continuous_midpoint

If set, computes the bounds of the continuous color scale to have the desired midpoint. Setting this value is recommended when using plotly.express.colors.diverging color scales as the inputs to color_continuous_scale.

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.

dimensions_max_cardinality

When dimensions is NULL and data_frame is provided, columns with more than this number of unique values are excluded from the output. Not used when dimensions is passed.

Value

A go_figure().

Examples

px_data_tips() |> px_parallel_categories(dimensions = ~c(sex, smoker, day), color = ~size)