geom_tree_tot_by_split | R Documentation |
geom_tree_tot_by_split
creates a 'treemap' chart of the total of one outcome, split by another outcome.
geom_tree_tot_by_split( df, outcome, splitvar, title = "", opts = list(treemapify::geom_treemap(alpha = 0.7), treemapify::geom_treemap_text(fontface = "italic", colour = "white", place = "centre", grow = TRUE, min.size = 1), theme(legend.position = "none", plot.title = element_text(hjust = 0.5))) )
opts |
can be substituted with a (predefined or in-function) list of style parameters |
in future we could try to make this more general, allowing other types of summary
geom_treemap_opts_1 <- list(treemapify::geom_treemap(alpha = 0.5), treemapify::geom_treemap_text(fontface = "italic", colour = "blue", place = "centre", grow = TRUE, min.size = 3 ), theme(legend.position = c(0.6, 0.2), plot.title = element_text(hjust = 0.5)) ) midwest %>% geom_tree_tot_by_split(popamerindian, state, title = "Shares of midwestern 'American Indian residents' by state", opts= geom_treemap_opts_1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.