If you have to use circles…

[This article was first published on Quantum Forest » rblogs, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Stats Chat is an interesting kiwi site—managed by the Department of Statistics of the University of Auckland—that centers around the use and presentation of statistics in the media. This week there was an interesting discussion on one of those infographics that make you cringe:

I understand the newspaper’s need to grab our attention, as well as the designer’s esthetical considerations, but they have to follow avoiding misleading the reader and providing at least a ball-park idea of the importance of whatever issue is under discussion. Clearly, as pointed out in the discussion, a line chart would convey the message with a minimum of ink; however, the designer may still want to use circles, and here we could go back to a faceted version of the always maligned pie chart.

Faceted pie charts using ggplot2

The code reads the data, reshapes it and plots it using pretty much the explanation for pie charts in the ggplot2 documentation.

# Location and librariesrequire(reshape)require(ggplot2)setwd('~/Dropbox/quantumforest')

# Reading data and melting into long shapebub = read.csv('bubble-data.csv', header = TRUE)bub2 = melt(bub, id = 'year')names(bub2)[2] <- 'worry'levels(bub2$worry)[3] <- 'Something else'
# Pie charts; no, really, pie charts!crazyPalette = scale_fill_manual(values = c('#7DADDD', '#EF1C22', '#BEC7D6'))crazy = ggplot(bub2, aes(x = factor(1), y = value, fill = worry))crazy = crazy + geom_bar(width = 1) + coord_polar(theta = 'y') +         facet_wrap(~ year) + crazyPalette +         scale_x_discrete('Worry per year (%)') + scale_y_continuous('')         crazy
view raw pie-charts.R This Gist brought to you by GitHub.

Again, please remember my typical disclaimer about lack of design and color flair. Colors and scales need work, but I think it is an improvement over the original.

To leave a comment for the author, please follow the link and comment on their blog: Quantum Forest » rblogs.

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.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)