Blog Archives

Setting graph margins in R using the par() function and lots of cow milk

June 30, 2010
By
Setting graph margins in R using the par() function and lots of cow milk

It is fairly straightforward to set the margins of a graph in R by calling the par() function with the mar (for margin!) argument. For example, par(mar=c(5.1,4.1,4.1,2.1) sets the bottom, left, top and right margins respectively of the plot region in number of lines of text. Another way is by specifying the margins in inches

Read more »

Response to Flowingdata Challenge: Graphing obesity trends

April 29, 2010
By
Response to Flowingdata Challenge: Graphing obesity trends

Nathan at Flowingata put up another interesting challenge today to improve the following graphic showing obesity trends in America. Here’s my attempt: I transposed the data so that the cohorts are on the X axis and each separate line represents an age group. So each line shows the percentage of obese people in a particular

Read more »

Responding to the Flowingdata GDP Graph Challenge

February 25, 2010
By
Responding to the Flowingdata GDP Graph Challenge

Nathan Yau of Flowingdata put up a challenge earlier today to improve upon a graph showing government spending as a percentage of GDP, published in the Economist. The underlying data wasn’t available. So I put on my graph-to-numbers glasses on and pulled out some data. Here it is in case you want to have a

Read more »