layout
data
setEPS()
postscript('figure.eps')
layout(matrix(c(0, 0, 1, 1, 2, 2, 3, 3, 4, 4), nrow=5, byrow=TRUE),
heights=c(0.2, 1, 1, 1, 1.4))
par(mar=c(0, 5, 0, 10.5))
boxplot(g1, xaxt='n', range=0, ylab='%', ylim=c(0, 100), col='white',
cex.lab=1.5, cex.axis=cex_main, cex.main=cex_main, cex.sub=1.5,
xlim=c(0.5, length(g1) + 0.5))
title('title', outer=TRUE, line=-1.5)
lines(g1_means, col='dark green', lwd=3)
par(xpd=TRUE)
legend('topright', inset=c(legend_space, 0), c('Control', 'Weighted Mean'),
col=c('black', 'dark green'), lwd=c(1, 3))
boxplot(g2, xaxt='n', range=0, main=NULL, ylim=c(0, 100), ylab='%', col='gray',
cex.lab=1.5, cex.axis=cex_main, cex.main=cex_main, cex.sub=1.5
, xlim=c(0.5, length(g2) + 0.5))
lines(g2_means, col='dark green', lwd=3)
par(xpd=TRUE)
legend('topright', inset=c(legend_space, 0), c('Case', 'Weighted Mean'),
col=c('black', 'dark green'), lwd=c(1, 3))
plot(p, xaxt='n', ylab='P', type='l', lty=1, lwd=3, cex.lab=1.5, cex.axis=1,
cex.main=cex_main, cex.sub=1.5, , log='y', xlim=c(0.5, length(p) + 0.5),
ylim=c(min(p, sum_p), max(p, sum_p)))
points(sum_p, xaxt='n', ylab='P', type='l', col='blue', lty=2, lwd=3)
par(xpd=TRUE)
legend('topright', inset=c(legend_space, 0), c('CpG P', 'Moving P Mean'),
col=c('black', 'blue'), lwd=c(3, 3), lty=c(1, 2))
par(mar=c(0, 5, 0, 10.5) + c(5, 0, 0, 0))
plot(percent, xaxt='n', ylab='% Diff.', xlab='CpG', type='l', lty=1, lwd=3,
cex.lab=1.5, cex.axis=1, cex.main=cex_main, cex.sub=1.5,
xlim=c(0.5, length(percent)+0.5), ylim=c(min(percent, sum_percent),
max(percent, sum_percent)))
points(sum_percent, xaxt='n', xlab='CpG', type='l', col='blue', lty=2, lwd=3)
par(xpd=TRUE)
legend('topright', inset=c(legend_space, 0), c('Percent', 'Moving Mean %'),
col=c('black', 'blue'), lwd=c(3, 3), lty=c(1, 2))
axis(1, at=1:length(xaxis), xaxis)
dev.off()
thanks to @count,解决方案只是使用
mar <- c(0, 5, 0, 10.5)
cex_main <- 1; legend_space <- -.26;
g1 <- list(c(47.058824, 100, 100), c(94.285714, 94.736842, 100), c(76.315789,
94.736842, 64.705882), c(59.459459, 57.894737, 100), c(62.5,
94.736842, 100))
g1_means <- sapply(g1, mean)
g2 <- list(c(13.75, 4.123711, 96), c(10.588235, 0, 92.592593), c(63.529412,
0, 60), c(35.294118, 6.25, 36.363636), c(52.873563, 6.25, 26.666667
))
g2_means<- sapply(g2, mean)
p <- c(0.0430904, 0.0587825, 0.124606, 0.0310268, 0.0344261)
sum_p <- c(0.0430904, 0.0443229, 0.0444647, 0.0393696, 0.0304293)
percent <- c(-65.1758, -73.8956, -40.2577, -38.4133, -50.5157)
sum_percent <- c(-65.1758, -69.332, -60.3056, -54.7893, -54.0582)
xaxis <- c(2984116, 2984148, 2984157, 2984168, 2984175)
las=2
设置要垂直读取的标签。