Interesting data this week from the Human Chronome Project which estimates how we spend our time on average across 8 categories and 24 subcategories. Data exists for every country and the global average so decided to compare Australia to the global average.
I went for a fairly simple layout of a double-stacked bar chart, one for the category and one for the subcategory. For a second I thought about using polar coordinates although even though the data spans 24 hours the categories don’t all occur in a block so I stuck with a wide, linear format.
The challenge I had was overlapping labels. Some of the categories and subcategories are small and the labels overlap. I could have used {ggrepel} to give some room for the labels but I don’t really like how it places the labels randomly around the point rather than in a single line.
To fix this I made a function breathing_space_on_x(). The function takes the x position of the labels and checks if the adjacent labels are too close. If so, it drops the y position down a desired amount and gives the label room to breathe. I’ve saved this in the package so I now have it on tap since this problem occurs a lot.
I like how it turned out. At first glance, it’s hard to see any major differences between Australia and the global average but when you focus on the labels it starts to become clear. Only having the description on the global average chart was a design choice so the reader flicks between the charts and spotting the differences (but also to make it easier to fit more on the page!).
Code is on Github 👍
