R wrapper for @visa/circle-packing via htmlwidgets.
Here is an example of circle-packing in action:
circle_packing(
data,
nodeAccessor,
parentAccessor,
sizeAccessor,
mainTitle = "",
subTitle = "",
accessibility = list(),
props = list(),
...
)
a visaChart htmlwidget object for plotting a circle packing plot
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.
String. Key used to determine circle's child, must be a unique child.
String. Key used to determine circle's parent.
String. Key used to determine circle size.
String. The dynamic tag of title for the map (or you can create your own separately). See highestHeadingLevel
prop for how tags get assigned.
String. The dynamic tag for a sub title for the map (or you can create your own separately). See highestHeadingLevel
prop for how tags get assigned.
List(). Manages messages and settings for chart accessibility, see object definition
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.
To see all available options for the chart properties/API see @visa/circle-packing.
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))
Run the code above in your browser using DataLab