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

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.

Value

A PlotSpec.