Description Usage Arguments Examples
View source: R/count_to_sunburst_treemap.R
These functions help you quickly create interactive hierarchical plots
from categorical data. They expect the summary of the data created by
dplyr::count()
and produce either a sunburst plot (count_to_sunburst()
) or
a treemap plot (count_to_treemap()
)
1 2 3 | count_to_sunburst(count_data, fill_by_n = FALSE, sort_by_n = FALSE)
count_to_treemap(count_data, fill_by_n = FALSE, sort_by_n = FALSE)
|
count_data |
An output of dplyr::count(), tibble or data frame |
fill_by_n |
If TRUE, uses a continuous scale to fill plot by group size |
sort_by_n |
If TRUE, sorts groups in plot by size, if FALSE sorts them alphabetically |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | library(dplyr)
starwars_count <- count(starwars, species, eye_color, name)
# sunburst plot
count_to_sunburst(starwars_count)
# fill by group size
count_to_sunburst(starwars_count, fill_by_n = TRUE)
# treemap plot, ordered by group size
count_to_treemap(starwars_count, sort_by_n = TRUE)
# display al charchaters by homeworld
starwars %>%
count(homeworld, name) %>%
count_to_treemap(sort_by_n = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.