A Treemap displays hierarchical data as a set of nested rectangles. Each group is represented by a rectangle, which area is proportional to its value. Visit data-to-viz.com for more theoretical explanation about what it is. For a R implementation, see below.
Treemap
package
The treemap
package is probably the best way to build
treemaps in R. The 3 examples below will teach you how to build a very
basic treemap, how to deal
with subgroups, and how to
customize the figure. Note that
once you master this package, you can very easily build an interactive
version as described below.
d3treeR
The d3treeR
allows to build interactive treemaps with
R
. Click on a group to zoom in and reveal subgroups.
Click on the group name on top to unzoom and come back to the previous
state. Note that the syntax used in previous charts above is exactly
the same. Only one more line of code is needed, give it a go!