sunburst | R Documentation |
Creates sunburst diagram from hierarchy and value data.
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") )
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. |
Utilizes a script similar to https://observablehq.com/@d3/sunburst adapted to work with r2d3.
A d3 object as returned by r2d3.
data(flare) sunburst(flare$ancestry.df, flare$leaf.df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.