0

我正在使用 zoo.plot 绘制一个多重堆叠图,其中 4 个 y 轴超过 1 个 x 轴。有没有办法交替 y 轴标签和刻度线的一侧,这样它们就不会在同一侧重叠。即顶部图,y 轴在左边,下一个图在右边等等?

我的情节代码如下所示:

library(zoo)
z <- with(df, zoo(cbind(depth, angle, Y, Z),as.POSIXct(time))) 
plot.zoo(z,  ylab=c("Depth (m)", "Pitch Angle (degrees)", "Swaying Acceleration (m/s^2)", "Heaving Acceleration (m/s^2)"), col=c("black", "blue", "darkred", "darkgreen"), 
     xlab = c("Time"), lwd=2, plot.type="multiple", ylim=list((rev(range(dive195.11drift$DEPTH))), c(-90,90), c(-10,10), c(-10,10)))
4

1 回答 1

1

我认为你必须自己做:

z <- zoo(cbind(a = 1:10, b = 10:1, c = rep(1:5, each = 2))) # test data

nc <- ncol(z)
opar <- par(mfrow = c(nc, 1), mar = c(2, 2, 1.5, 2))
for(i in 1:nc) { plot(z[, i], yaxt="n", main=colnames(z)[i]); axis(2+2*i%%2) }
于 2012-08-03T17:32:33.933 回答