Skip to content

Instantly share code, notes, and snippets.

@ottadini
Created October 15, 2013 04:44
Show Gist options
  • Save ottadini/6986605 to your computer and use it in GitHub Desktop.
Save ottadini/6986605 to your computer and use it in GitHub Desktop.
R base graphics and ggplot2 parameters for consistent plots
# Base graphics
# Create a PDF for a square shaped plot (e.g. for predictions vs observations regression)
pdf(file="pred-vs-meas_MLR.pdf", width=5, height=5, family="Times")
op <- par(pty='s') # plot type = square
plot(X, Y,
xlab=Xlabel, ylab=Ylabel, ylim=c(0, 3), xlim=c(0, 3)) #
abline(fit, lty=2)
par(op)
text(0.1, 2.8, equation1, pos=4)
text(0.1, 2.6, equation2, pos=4)
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment