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_ChoroplethConfig(
  location = NULL,
  value = NULL,
  tooltip = NULL,
  resolution = "country",
  classification = "quantile",
  num_classes = 5,
  colormap = "blues",
  opacity = 1,
  show_boundaries = TRUE,
  outline_width = 0.2,
  show_legend = TRUE,
  legend_position = "bottom-right",
  tooltip_position = "top-right",
  value_label = NULL,
  title = NULL,
  dat_path = NULL,
  origin = NULL,
  writer = NULL
)

Arguments

location

Optional Character: Column holding the region identifiers.

value

Optional Character: Column holding the value to shade by.

tooltip

Optional Character: Column holding per-region tooltip text.

resolution

Character {"country", "state", "county"}: Which boundary set the locations refer to.

classification

Character {"quantile", "equal", "jenks"}: How values are binned into classes.

num_classes

Numeric [2, 12]: Number of color classes.

colormap

Character: Continuous color scheme for the classes.

opacity

Numeric [0, 1]: Fill opacity.

show_boundaries, show_legend

Logical: Whether to draw each.

outline_width

Numeric [0, Inf): Boundary line width.

legend_position, tooltip_position

Character: Corner each overlay is anchored to.

value_label

Optional Character: Label for the value in the legend and tooltip. NULL derives it from the bound column.

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.

Value

ChoroplethConfig object.

Author

EDG

Examples

states <- data.frame(st = c("CA", "TX", "NY"), v = c(1, 2, 3))
draw(
  setup_ChoroplethConfig(location = "st", value = "v", resolution = "state"),
  data = states
)