Monday, April 22, 2013

ggplot Style in Classic R Plots

ggplot is a highly acclaimed R package for plotting. I have had very little experience with the library because I've mostly memorized all the quirks of normal R plots. I like the ggplot default style though, so I thought write down how to replicate it in R plots. The distinctive feature of ggplot is the gray rectangle and white grid lines. This may be replicated like so:



Here's an example



Here's the code to generate that plot:

If you ever dislike that extra space that extends the plot region, it may be removed by adding xaxs="i" to par or plot.

No comments:

Post a Comment