Skip to contents

Creates a sunburst plot where different depth levels can use different fill colour mappings. Uses ggnewscale::new_scale_fill() to enable multiple fill scales in a single plot.

Usage

sunburst_multifill(sb, fills, colour = "white", linewidth = 0.2, ...)

Arguments

sb

A sunburst_data object from sunburst_data().

fills

A named list mapping depth levels (as character strings) to column names in sb$rects for fill mapping. E.g., list("1" = "name", "2" = "value").

colour

Border colour for rectangles. Default "white".

linewidth

Border line width. Default 0.2.

...

Passed to ggplot2::geom_rect().

Value

A ggplot object with coord_polar() and theme_void(). Users can add scale_fill_*() calls after the plot to control each depth's colour palette.

See also

icicle_multifill() for the rectangular variant, sunburst() for single-scale fill.

Examples

sb <- sunburst_data("((a, b, c), (d, e));")
if (requireNamespace("ggnewscale", quietly = TRUE)) {
  sunburst_multifill(sb, fills = list("1" = "name", "2" = "name"))
}