Skip to contents

The seam between convenient input and a complete, validated object. Every argument is optional, which is what lets the published schema require nothing.

Usage

setup_PieConfig(
  values = NULL,
  labels = NULL,
  radius = "75%",
  rose_type = NULL,
  label_format = "name",
  percent_digits = 1L,
  palette = NULL,
  title = NULL,
  dat_path = NULL,
  origin = NULL,
  writer = NULL,
  legend_position = "top",
  legend_placement = "outside"
)

Arguments

values

Optional Character: Column holding the slice values.

labels

Optional Character: Column holding the slice labels.

radius

Character: Outer radius, as a CSS length or percentage.

rose_type

Optional Character {"radius", "area"}: Draw as a Nightingale rose chart, sizing slices by radius or by area. NULL draws a plain pie.

label_format

Character {"name", "value", "percent", "name_value", "name_percent"}: Slice label content.

percent_digits

Integer [0, 6]: Percentage precision.

palette

Optional Character: Slice colors, overriding the theme palette for this chart. NULL uses the theme's.

title

Optional Character: Chart title. Declared here because it is the one property every chart type has; palette is not (four take a colormap instead), and axis labels and margins are cartesian-only.

dat_path

Optional Character: Path to the data, read at draw time. The serializable alternative to passing data to draw().

origin

Optional Named character: Where each value came from. Normally computed from which arguments were supplied; pass it only when restoring a config that already carries provenance.

writer

Optional Named character: Which interface wrote the config.

legend_position

Character {"top", "bottom", "left", "right", "top-left", "top-right", "bottom-left", "bottom-right"}: Legend anchor. Top/bottom anchors use horizontal rows; left/right anchors use a vertical column. Corner anchors align within the top or bottom row.

legend_placement

Character {"outside", "inside"}: Relation to the plotting area. Outside placement reserves space for the complete legend; inside placement overlays the data. Neither setting adds a missing legend.

Value

PieConfig object.

Author

EDG

Examples

counts <- data.frame(kind = c("a", "b", "c"), n = c(3, 5, 2))
draw(setup_PieConfig(values = "n", labels = "kind"), data = counts)