Circular packing or circular treemap allows to visualise a hierarchic architecture. It is an equivalent of a treemap or a dendrogram, where each branch of the tree is represented as a circle and its sub-branches are represented as circles inside of it.

The size of each circle can be proportional to a specific value, what gives more insight to the plot. If only one level of hierarchy is displayed (no encapsulation), it becomes equivalent to a barplot. Instead of showing the value of each individual as a bar, it

uses a circle. Circle packing is not recommend if you need to precisely compare values of group. However, it shows very well how groups are organised in subgroups. It uses the space less efficiently than a treemap, but the hierarchy gets more obvious.




Circle packing with one level only

One level means that you just have a list of entities to represent, with a value for each. (The value will be proportional to the size of the circles). In this case, I advise to rely on the packcircles library that will calculates the optimal position of each circle, and then use ggplot2 to draw the circles.




Interactive version

The ggiraph library allows to get an interactive version of circular packing with 1 level. This is really handy: hover the plot and you will get more information concerning each circle. See the code here.

Circle packing with several levels

If you have several levels in your hierarchy and need a static version, I strongly advise to use the ggraph library. It is really convenient in term of input format, respect the grammar of graphic (ggplot syntax), allows every type of customisation, and allows to switch easily to another type of representation.

Interactive version

The circlepackeR library allows to build interactive circle packing. Click on a group, and a smooth zoom will reveal the subgroups behind it. The graph #338 is dedicated to its use. It shows how to create it using several input formats, and gives a few tips to customize it. See code.



Search the gallery