multiple double y-axis plots via loop R -


i have following code create simple split y-axis plot. loop through (as example) edhec data set each panel in matrix of panels has 2 lines: first vector of edhec on left , 1 of subsequent vectors on right:

library(zoo) library(performanceanalytics)  data(edhec) edhec <- as.zoo(edhec) plot(edhec[ ,1], ylab=colnames(edhec[ ,1]), lwd=2) par(new=true) plot(edhec[ ,2], ann=false, yaxt="n", col="darkgreen", lwd=1) axis(side=4) 

thanks help!

i'm guessing want?

library(zoo) library(performanceanalytics)  data(edhec) edhec <- as.zoo(edhec)  par(mfrow=c(ceiling(ncol(edhec)/2), 2),    mar=c(0, 2, 0, 2), oma=c(2, 0, 1, 0), mgp=c(2, 0.7, 0))  invisible(lapply(1:ncol(edhec),    function(x) {       par(new=false)       plot(edhec[, x],          xaxt=ifelse(x >= ncol(edhec) - 1, "s", "n"),         ylab="")       par(new=true)       plot(edhec[, x + 1], col="darkgreen", ann=false, xaxt="n", yaxt="n")       axis(side=4)   } )) 

enter image description here


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -