I am exporting some plots to EPS files. My code is
setEPS()
postscript("test.eps")
par(mar=c(0,0,0,0))
plot(1:10)
dev.off()
But I find that there are (device) margins around the plotting area. How to remove them? Thank you.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That isn’t a margin. Notice how there are no axes, tick marks or plot frame in the EPS produced by your code. There is no room to draw these and the plot frame will be exactly on the edge of the EPS.
What you are seeing is the extra padding that R adds to the axis limits to ensure that the plotting characters are inside the plot region, not on it’s edge. IIRC this padding is 4%.
You can turn this off using using the
xaxsandyaxsplotting parameters for the x- and y-axis respectively; see?parThe default is
"r", instead use: