This post explains how to build a very basic
treemap with R. It uses the
treemap package, provides reproducible code and
explains how input data must be formatted.
This is the most basic treemap you can do. The input dataset is simple: we just have 3 groups, and each has a value which we map to an area.
It allows to learn the syntax of the treemap library:
you need to provide at least a dataset (data), the
column that provides groups (index), and the column
that gives the size of each group (vSize).
See graph #235 to learn how to add subgroups, and graph #236 to customize the chart appearance.
👋 After crafting hundreds of R charts over 12 years, I've distilled my top 10 tips and tricks. Receive them via email! One insight per day for the next 10 days! 🔥