Skip to contents

Creates an icicle (rectangular, top-down) plot from a sunburst_data object using ggplot2::geom_rect() with scale_y_reverse() and theme_void().

Usage

icicle(
  sb,
  fill = NULL,
  colour = "white",
  linewidth = 0.2,
  show_labels = FALSE,
  show_node_labels = FALSE,
  label_size = 3,
  min_label_angle = 0,
  label_repel = FALSE,
  ...
)

Arguments

sb

A sunburst_data object from sunburst_data().

fill

Fill mapping. Accepts bare names or strings. One of:

  • NULL (default): static grey fill (no aesthetic mapping).

  • "auto": maps fill to the depth column.

  • "none": explicit static grey fill (same as NULL).

  • A column name: either bare (fill = depth) or quoted (fill = "depth"). In a future version, the default may change from NULL (static grey) to "auto" (depth mapping). Use "none" for an explicit static grey fill that will not change.

colour

Border colour for rectangles. Default "white".

linewidth

Border line width. Default 0.2.

show_labels

Whether to add text labels. Default FALSE.

show_node_labels

Whether to add text labels for internal nodes. Only takes effect when show_labels = TRUE. Default FALSE.

label_size

Text size for labels. Default 3.

min_label_angle

Minimum angular extent (degrees) for a node to receive a label. Nodes with delta_angle < min_label_angle are not labelled. Default 0 (no filtering).

label_repel

Use ggrepel::geom_text_repel() for collision avoidance. Requires the ggrepel package. Default FALSE.

...

Passed to geom_rect().

Value

A ggplot object with scale_y_reverse() and theme_void().

See also

sunburst_data() for data preparation, sunburst() for polar layouts, donut() for ring charts.

Examples

sb <- sunburst_data("((a, b, c), (d, e));")
icicle(sb)

icicle(sb, fill = "depth")

if (FALSE) { # \dontrun{
icicle(sb, fill = "depth", show_labels = TRUE, label_repel = TRUE)
} # }