考虑以下R代码的输出:
par( mar=c(5,4,4,5)+.1 )
boxplot( t( matrix( rnorm( 100 ), nrow=10 )), xlab="Var1", ylab="Var2")
par( new=T )
plot( 1:10, runif(10,min=-2, max=3), xaxt='n', yaxt='n', xlab='', ylab='', type='b', col='blue', pch=15 )
axis(4)
mtext("Var3", side=4, line=3 )蓝色的点不与x轴对齐。我想让这两个图正确地共享x轴。我尝试过对boxplot使用at参数,但这给出了奇怪的输出。
提前感谢!
主键^_^
发布于 2013-02-26 22:40:09
为什么不直接使用lines呢?
par( mar=c(5,4,4,5)+.1 )
boxplot( t( matrix( rnorm( 100 ), nrow=10 )), xlab="Var1", ylab="Var2")
lines( 1:10, runif(10,min=-2, max=3), type='b', col='blue', pch=15 )
axis(4)
mtext("Var3", side=4, line=3 )

https://stackoverflow.com/questions/15091798
复制相似问题