Pie charts have been justifiably criticized for one very important reason (and many less important reasons: pie charts are bad at “the one thing they’re ostensibly designed to do,” and that is to show the relationship of parts of the whole. Check out this site for some egregious examples of failing to represent one’s data clearly.
A student of mine in IS240 (Intro to Research Methods in Intl. Studies) may have unknowingly redeemed the besmirched reputation of the pie chart. The upshot, though, is that she was using the pie chart (along with some clever colour manipulation) to compare results across pie charts, not within.
Here are three pie charts, depicting the answers to a question in the World Values Survey that taps into the concept of homophobia. The potential response set for this question was ordinal in nature, ranging from 0 to 10, with 1 representing the most homophobic response, and 10 the least. Using a colour ramp, this student produced the pie charts you can see below. Essentially, the charts are easy to compare across countries: the more red you see, the more homophobic the responses to that question!
Very nicely done! The R-code to produce these is below. You’ll need v202 and v2 of the World Values Surveys in a data frame (which we have called four.df):
Here is the R code to produce three separate PDF files, one with each chart:
piecolor<-colorRampPalette(c("red","white")) names<-c("canada","italy","thailand") Cnames<-c("Canada","Italy","Thailand") for (i in 1:3) { +pdf(file=Cnames[i].pdf) + pie(table(factor(four.df$v202[four.df$v2==names[i]])),col=piecolor(10), main=Cnames[i]) + dev.off() + }
You must be logged in to post a comment.