R graphics: margins are way to large
[This article was first published on Gregor Gorjanc (gg), and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
For me R has a very nice and powerfull capabilities for graphics (for example see this gallery). However, I dislike the default setting for margins and placement of axis numbers and labels. Since I always forget the setting of parameters I prefer I am adding this post. For example:
Now compare this plot to the version I prefer much more:library(package="MASS") Sigma <- matrix(c(10, 10, 10, 20), nrow=2) mu <- c(100, 100) tmp <- mvrnorm(n=200, mu=mu, Sigma=Sigma, empirical=TRUE) plot(tmp, xlab="X variable (unit)", ylab="Y variable (unit)")
par(bty="l", pty="m", mar=c(3, 3, 1, 1), mgp=c(1.75, 0.75, 0)) plot(tmp, xlab="X variable (unit)", ylab="Y variable (unit)")
To leave a comment for the author, please follow the link and comment on their blog: Gregor Gorjanc (gg).
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.