As we noted last month, the new Themes feature in ggplot2 helps you customize the design of R charts to your liking. Now, R user Jeffrey Arnold has built on this feature to create standardized themes to make R graphics looks like those from major publications and other software systems. You can use his ggthemes package to make your charts look like those in The Economist:
or as if it was created with data visualization software Tableau:
or if you're an R user on the down-low, with that "classic ugly look and feel" of Microsoft Excel. (A better idea would be to just come out!)
You can download Jeffrey's ggthemes package from github. Not included in the package (yet) is a theme mimicking the hand-drawn style of the charts featured in the XKCD comic series, but StackOverflow is all over it. For example, Mark Bulling shared the ggplot2 theme that created this XKCD-styled chart of Google Trends data:
By the way, if you want to create similar charts reflecting the rate at which specific Google searches are performed, you can use the new rGtrends package from Edmund Hart.
Except that graph does not look like it came from The Economist. Faithful readers know that in such a graph the y-axis labels are ALWAYS on the right, not the left.
Posted by: Kit Baum | October 07, 2012 at 04:00
They drive on the wrong side of the road too.
Posted by: Robert Young | October 07, 2012 at 10:31
Lattice users can also access The Economist styled graphs (with y-axis on the right) using the latticeExtra package. http://latticeextra.r-forge.r-project.org There is a ggplot2-like style too!
Posted by: Luis | October 07, 2012 at 22:12
Awesome! Thanks again for the great article.
Posted by: Mohamed Amr Elgeneidy | October 08, 2012 at 07:09
Unfortunately, right now ggplot always puts the y-axis labels on the right side, thus the theme is only an approximation. And really loyal Economist readers would know that The Economist plots use ITC Officina Sans as their font, not Helvetica as is used in the example.
Posted by: jrnold | October 08, 2012 at 14:11