问题
I am trying to set the figure margin for a pdf generated with R. Using mar, I can reduce the plot margins. However the resulted plot is still a square in the middle of the page instead of using all the space. How can I change that?
pdf(file = "test.pdf", paper="a4r")
par(mar=c(0,0,0,0)+0.1)
plot(1:10,1:10)
dev.off()
Thank you!
回答1:
Within pdf(), change the width and height arguments (https://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/pdf.html). The default values are 7 and 7, which is likely why there is extra space on your page.
来源:https://stackoverflow.com/questions/40603079/r-pdf-set-margin