[R] graph: add 2 inches on the left outer region, but keep everything unchanged
Xing Zhao
zhaoxing at uw.edu
Thu Apr 17 10:43:38 CEST 2014
Hi R experts,
My original graph was plotted, and for some reason, I need to add
extra '2' inches on the left side.
Meanwhile, I want to keep everything unchanged. Particularly, the
length-width ratio for each panel of the original graph is nice,
therefore I want to keep the original ratio
Adding 2 inches to the pdf(width=) and oma=c(0,2,0,0) does not keep
the original length-width ratio.
Thanks for your help
Xing
#orignal plot
pdf(file="d:/test.pdf",width=7, height=7)
par(mfrow=c(3,4), mar=c(3,3,2,1), mgp=c(2,.7,0), tck=-.037)
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
dev.off()
#new plot
#want to keep everything unchanged, but 2 inches on the left outer region
pdf(file="d:/test.pdf",width=9, height=7)
par(mfrow=c(3,4), mar=c(3,3,2,1), mgp=c(2,.7,0), tck=-.03,oma=c(0,2,0,0))
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
plot(c(-2,32),c(-0.1,0.9),
type="line",ylim=c(-0.1,0.9),xlab='',ylab="", xaxt='n', yaxt='n')
dev.off()
More information about the R-help
mailing list