0

I am using zoo.plot to plot a multiple, stacked plot with 4 y axes over 1 x axis. Is there a way alternate the side of the y axis labelling and tick marks so they dont overlap on the same side. i.e. top plot, the y axis is on the left, next plot its on the right and so on?

The code for my plot looks like this:

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)))
Jojo
  • 4,951
  • 7
  • 23
  • 27

1 Answers1

1

I think you will have to do it yourself:

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) }
G. Grothendieck
  • 254,981
  • 17
  • 203
  • 341