Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
I get what they are trying to do – illustrate trends within categories over time – but I don’t think years as coloured bars is the way to go. To me, progression over time suggests that time should be an axis, so as the eye moves along the data from one end to the other, without interruption. What I want to see is categories over time, not time within categories.
So what is the way to go? Let’s ask “what would ggplot2 do?”
The following charts illustrate different ways to visualise the same data using ggplot2
. My motivation here is to show you that if you don’t immediately know or see a “right way” to do something, tools such as ggplot2
make it easy to “feel your way” to a solution, through exploration.
The charts and their accompanying code are available at RPubs. Click each image at right for a full-size version.
It looks better already just for being generated using ggplot2
. But can we go better?
I think this works much better: the continuous connection of categories makes it easier to follow each one through time. However, there is still the issue of relative versus absolute values. And to my eye, downward lines can be interpreted as decreases even when the width of the area for a category indicates that the value has increased.
Now we’re getting somewhere – much easier to follow each category over time. One issue with this particular arrangement is that it’s a little difficult to compare categories and the eye finds it difficult to isolate a facet from surrounding facets.
Not bad at all – this makes categories within a year very clear. But wait, we wanted a good view of each category over time. So how about…
I think we have a winner. This clearly illustrates change per category over time and the layout and common scales even allow for comparison between categories.
We started out complaining about time within categories but in fact, that is what we wanted after all: just arranged in a better way than years as coloured bars .
Filed under: R, statistics Tagged: ggplot2, visualisation
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.