Make Treemap Bar Charts with 'ggplot2'

Provides 'ggplot2' geoms analogous to 'geom_col()' and 'geom_bar()' that allow for treemaps using 'treemapify' nested within each bar segment. Also provides geometries for subgroup bordering and text annotation.


ggtreebar

The goal of ggtreebar is to provide ggplot2 geoms analogous to geom_col() and geom_bar() that allow for treemaps using treemapify nested within each bar segment.

Installation

You can install ggtreebar with the following command:

install.packages("ggtreebar")

You can install the development version of ggtreebar like so:

# install.packages("pak")
pak::pak("hrryt/ggtreebar")

Example

This is a basic example which shows you how to solve a common problem:

library(ggplot2)
library(ggtreebar)
ggplot(diamonds, aes(clarity, fill = cut, subgroup = color)) +
  geom_treebar()
ggplot(diamonds, aes(clarity, fill = cut, subgroup = cut, subgroup2 = color)) +
  geom_treebar() +
  geom_treebar_subgroup_border() +
  geom_treebar_subgroup2_text()
ggplot(diamonds, aes(y = cut, fill = color, subgroup = clarity)) +
  geom_treebar(position = "dodge")

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("ggtreebar")

0.1.0 by Harry Thompson, a year ago


https://github.com/hrryt/ggtreebar, https://hrryt.github.io/ggtreebar/


Report a bug at https://github.com/hrryt/ggtreebar/issues


Browse source code at https://github.com/cran/ggtreebar


Authors: Harry Thompson [aut, cre, cph]


Documentation:   PDF Manual  


GPL (>= 3) license


Imports grid, ggplot2, treemapify, ggfittext, dplyr, cli


See at CRAN