Skip to content

Fix sunburst/partition hierarchy display and add partition (icicle) example#29

Draft
yihui-bot with Copilot wants to merge 5 commits into
mainfrom
copilot/update-sunburst-mark-example
Draft

Fix sunburst/partition hierarchy display and add partition (icicle) example#29
yihui-bot with Copilot wants to merge 5 commits into
mainfrom
copilot/update-sunburst-mark-example

Conversation

Copilot AI commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the sunburst mark example which used overly uniform data (all children at the same depth), adds the missing partition (icicle) mark example, and improves both charts to show clear visual hierarchies with name-based labels and colors.

Changes

Sunburst example data improved

The tree data now has varying nesting depths so the sunburst "sun rays" extend to different heights:

  • Frontend → 4 levels deep (Frontend → React → JSX → Components/Fragments)
  • Backend → 3 levels deep (Backend → Python → Django/Flask/FastAPI)
  • Data → 2 levels deep (Data → R/Julia)
  • DevOps → 1 level deep (leaf node)

Hierarchy display fixed for both marks

  • Added color = 'name' encoding so each node gets a distinct color, making the hierarchy visually clear
  • Added labels with text = 'name' to show node names instead of G2's default numeric value labels
  • Partition labels use position = 'left' with dx = 8 offset (matching G2's own test examples)

mark_partition() upgraded to proper wrapper

G2's partition mark has a hardcoded axis: { x: { title: 'Time/Order' } } default that is confusing for R users. Upgraded mark_partition() from a simple one-line wrapper to a proper function (like mark_sunburst()) that sets axis = FALSE and legend = FALSE by default.

Partition (icicle) example added

Added a new ## Partition (Icicle) Mark section to examples/marks.Rmd using the same tree data, with name labels and overflowHide transform.

Roxygen updates

  • Updated mark_sunburst() example to include color = 'name' encoding and name labels
  • Added mark_partition() example with name-based encoding and labels

Other missing mark examples

Checked all marks defined in R/mark.R against examples/marks.Rmd. The remaining marks without Rmd examples are low-level primitives not typically used directly:

  • mark_vector — specialized for wind/flow field visualization
  • mark_node / mark_edge — graph primitives wrapped by mark_force_graph()
  • mark_box — pre-computed box elements (low-level building block for mark_boxplot())
  • mark_shape — custom JS render function

Verification

  • R CMD check: Status: OK
  • Headless browser test: 42 canvases rendered, 0 JS errors
  • Version bumped to 0.0.14

Screenshots

Sunburst Mark (varying depth, name labels and colors)

Partition (Icicle) Mark (name labels, no Time/Order axis)

Copilot AI and others added 2 commits April 2, 2026 22:31

@yihui-bot yihui-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the two plots are still wrong (i don't see clear hierarchies in them); for the partition mark, x axis title is Time/Order; where is that from?

Copilot AI commented Apr 3, 2026

Copy link
Copy Markdown
Contributor Author

the two plots are still wrong (i don't see clear hierarchies in them); for the partition mark, x axis title is Time/Order; where is that from?

Fixed in b886f5c:

  1. Both sunburst and partition now encode color = 'name' and use labels with text = 'name' instead of the G2 default text = 'value' (which showed numbers). This makes the hierarchy visible through distinct node colors and name labels.

  2. The "Time/Order" x-axis came from G2's hardcoded partition defaults (partition.ts line 247). Made mark_partition() a proper wrapper (like mark_sunburst()) that sets axis = FALSE and legend = FALSE by default.

Sunburst:
sunburst

Partition:
partition

Copilot AI changed the title Fix sunburst data with varying depth and add partition (icicle) example Fix sunburst/partition hierarchy display and add partition (icicle) example Apr 3, 2026
Copilot AI requested a review from yihui-bot April 3, 2026 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants