sunburst: Sunburst diagram

View source: R/sunburst.R

sunburstR Documentation

Sunburst diagram

Description

Creates sunburst diagram from hierarchy and value data.

Usage

sunburst(
  ancestry.df,
  leaf.df,
  parent.column = "parent",
  child.column = "child",
  id.column = "id",
  value.column = "value",
  color.scheme = c("Spectral", names(d3po::color.schemes)),
  width = NULL,
  height = NULL,
  viewer = c("internal", "external", "browser")
)

Arguments

ancestry.df

data.frame containing edge data for all parents/children.

leaf.df

data.frame containing values for nodes without children.

parent.column

Name of column in ancestry.df containing parent nodes. Defaults to "parent".

child.column

Name of column in ancestry.df containing child nodes. Defaults to "child".

id.column

Name of column in leaf.df containing node names. Defaults to "id".

value.column

Name of column in leaf.df containing leaf values. Defaults to "value".

color.scheme

Color scheme to use in visualization. See color.schemes for more details.

width

Desired width for output widget.

height

Desired height for output widget.

viewer

"internal" to use the RStudio internal viewer pane for output; "external" to display in an external RStudio window; "browser" to display in an external browser.

Details

Utilizes a script similar to https://observablehq.com/@d3/sunburst adapted to work with r2d3.

Value

A d3 object as returned by r2d3.

Examples

data(flare)

sunburst(flare$ancestry.df, flare$leaf.df)


tkmckenzie/d3po documentation built on June 2, 2022, 2:41 p.m.