Skip to content

Instantly share code, notes, and snippets.

@whitead
Last active December 17, 2015 07:29
ggplot snippet 1
#set-up plot coordinate system.
plot(0,0, xlim=c(0,10), ylim=c(0,10), xlab="X", ylab="Y")
#cover up plot with rectangle
rect(par("usr")[1],par("usr")[3],par("usr")[2],par("usr")[4],col = "dark gray")
#now plot the grid
grid(col="white", lty=1)
#now plot data with specific plot type
lines(...)
points(...)
#make sure to put the "add=T" to prevent
#hist from replacing the plot.
hist(..., add=T)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment