Skip to contents

PlotSpec is the S7 class that vplot() creates and the mark_*() / scale_*() functions extend. It is a plain, inspectable, serializable data object: data, a list of layers, a list of scale overrides, and the page size. Nothing is drawn until it is compiled with vellum::as_vellum_scene() (e.g. via render_plot()). Printing it draws the plot; inspect its structure with base::summary().

Usage

PlotSpec(
  data = NULL,
  edge_data = NULL,
  layers = list(),
  scales = list(),
  facet = NULL,
  coord = NULL,
  resolve = list(),
  width = 6,
  height = 4,
  dpi = 96,
  theme = NULL,
  labels = list(),
  marginal = NULL,
  selections = list(),
  filters = list(),
  binds = list(),
  clip = NULL,
  transition = NULL,
  ease = NULL,
  source = NULL
)

Arguments

data

The data frame.

edge_data

For a graph plot (from vgraph()), the edge table; the default data for mark_edges(). NULL for ordinary plots.

layers

A list of layer specifications (one per mark_*()).

scales

A list of declared scale overrides.

facet

A faceting specification (from facet_wrap() / facet_grid()), or NULL for a single panel.

coord

A coordinate specification (from coord_cartesian() / coord_flip() / coord_fixed()), or NULL for the default Cartesian system.

resolve

A named list mapping an aesthetic to "shared" or "independent" (the scale-resolution lattice; see resolve_scale()).

width, height

Page size in inches.

dpi

Output resolution in dots per inch (pixels per inch). The exported PNG's pixel dimensions are width * dpi by height * dpi.

theme

A theme (a named list of resolved element/setting overrides, from theme() / a theme_*() preset), or NULL for the default theme.

labels

A named list of plot/axis/legend label overrides (see labs()).

marginal

A marginal-distribution specification (from add_marginal()), or NULL for no marginals.

selections

A list of interactive selection declarations (from select_point() / select_interval() / add_selection()).

filters

A list of filter declarations (from filter_by()).

binds

A list of scale-domain bind declarations (from bind_scale()).

clip

A clip_to() / set_mask() geometry clip (a ClipSpec), or NULL for none.

transition

A keyframe-animation transition (from transition_states() / transition_time() / transition_reveal()), or NULL. Read only by animate(); inert on a static render.

ease

An animation easing (from ease_aes()), or NULL.

source

A source-inspection declaration (from inspect_source()), or NULL. Inert on a static render; a host surfaces the data rows behind a clicked element.

Value

A PlotSpec.