« Political winds and hair styling | Main | Sorting out the data, and creating the head-shake manual »

Comments

mankoff

I think you have interpreted the original graph incorrectly. The axis is "gain in score". An increase of near-zero means "no gain" or, as originally described, a "virtual standstill". There are only two decreases - white and black 8th grade math. The absence of a column means the score changed by 0, which means no progress, although all the other 2009-2015 increase are so small that they are approximately no progress.

I agree the first graph isn't the best representation, but at least I can interpret it. Your re-do makes it appear that scores dropped, which is not the case.

mankoff

On further reflection - the redone graph should have 3 data point on the X axis: 2000, 2009, and 2015. The Y axis should be score relative to 2000. Most go up by 5-20 between 2000 and 2009, and then near-flat from 2009 to 2015. The repetition of 2009 is not an editorial oversight. I think the scores were measured in 2000, 2009, and 2015, so to show the change in score 2009 needs to be used both times, at least for their chosen display.

Andrew Gelman

Kaiser:

I think it would be better to plot trends in score rather than gain scores. Looking at gain scores requires a higher level of abstraction and to me just seems to add unnecessary confusion.

Kate

I have been trying to plot these types of charts in R. Do you perhaps have some example code I could use?

Kaiser

mankoff & Andrew: Look out for today's post. Short answer is I fetched the raw data and made more charts.

Kate: Didn't do those in R but if I were to do those in R, I tend to make them from scratch. If you follow this path, you would need to pick up these key things:
- setting up panels of charts using par(mfrow=c(x,y)) or similar
- writing a function that creates a single chart with the three lines so that you can run it three times to get a panel of three charts
- within that line chart function, you first suppress the default axes, then draw each axis separately, with custom labeling, tickmarks, etc. then draw in the box. Add gridlines as you please.
- specify line colors and style to your liking (this requires you to look up conversion tables of numbers to colors, and numbers to style... they lied when they say this is easy!)
- configuring the right spacing between charts by manipulating whitespace using par(mar=c(m,n,l,k)) or similar
- use text function to place other annotations such as line labels
- you may encounter more annoying little tasks like turning the axis labels to the right orientation, or needing to reduce font size to fit within plot region

Maybe one of our readers can whip up some sample code for you.

Kaiser

Kate: P.S. You can also use a package like ggplot2. You won't be able to make the chart look exactly like mine but close enough. Hadley recently said he added some functionality to ggplot2, such as the ability to place a chart title.

Kate

Thanks very much for the instructions. Will give it a go with ggplot2.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Your Information

(Name is required. Email address will not be displayed with the comment.)

NEW BOOTCAMP



Link to Principal Analytics Prep

See our curriculum, instructors. Apply.
Marketing analytics and data visualization expert. Author and Speaker. Currently at Columbia. See my full bio.

Book Blog



Link to junkcharts

Graphics design by Amanda Lee

The Read



Good Books

Keep in Touch

follow me on Twitter

Residues