circle_packing {visachartR} | R Documentation |
circle_packing
Description
R wrapper for @visa/circle-packing via htmlwidgets.
Here is an example of circle-packing in action:
Usage
circle_packing(
data,
nodeAccessor,
parentAccessor,
sizeAccessor,
mainTitle = "",
subTitle = "",
accessibility = list(),
props = list(),
...
)
Arguments
data |
required to be a valid, R data frame. Data used to create chart, an array of objects which includes keys that map to chart accessors. See d3-hierarchy.stratify() for additional detail on data requirements. |
nodeAccessor |
String. Key used to determine circle's child, must be a unique child. |
parentAccessor |
String. Key used to determine circle's parent. |
sizeAccessor |
String. Key used to determine circle size. |
mainTitle |
String. The dynamic tag of title for the map (or you can create your own separately). See |
subTitle |
String. The dynamic tag for a sub title for the map (or you can create your own separately). See |
accessibility |
List(). Manages messages and settings for chart accessibility, see object definition |
props |
List(). A valid R list with additional property configurations, see all props for @visa/circle-packing |
... |
All other props passed into the function will be passed through to the chart, see all props for @visa/circle-packing. |
Details
To see all available options for the chart properties/API see @visa/circle-packing.
Value
a visaChart htmlwidget object for plotting a circle packing plot
Examples
library(dplyr)
data.frame(parent = c(NA, "A", "A", "C", "C"),
node = c("A", "B", "C", "D", "E"),
size = c(NA, 8L, 7L, 6L, 5L)) %>%
circle_packing("node", "parent", "size",
accessibility = list(hideTextures = TRUE,
hideDataTableButton = TRUE))
library(dplyr)
data.frame(Orange) %>%
mutate(age = as.character(age)) %>%
bind_rows(data.frame(Tree = c(rep("Trees", 5), NA),
age = c(1:5, "Trees"))) %>%
circle_packing("age", "Tree", "circumference",
accessibility=list(hideTextures = TRUE,
includeDataKeyNames = TRUE,
hideDataTableButton = TRUE))