Это может быть достигнуто следующим набором шагов:
par(mar = c(5, 5, 3, 5)) # right side margin must be adjusted for mtext
plot(1:100, y)
par(new=TRUE)
plot(1:100, pchange, axes = FALSE, ylab="", xlab="") #axes, ylab and xlab prevents overwritting
axis(side = 4) # adds the right scale
mtext("Change in [%]", side=4, line=3)
РЕДАКТИРОВАТЬ: Значения RHS и LHS связаны:
set.seed(123)
x <- rnorm(100)
y <- cumsum(x)
lastval <- tail(y,1)
labels <- round(100*(seq(-2,10,2)-lastval)/lastval, 1)
plot(1:100,y, main=(paste("Last Value is ", round(lastval,2))) )
axis(side = 4, at=seq(-2,10,2), labels=labels)
abline(h=seq(-2,10,2), col="grey")
mtext("Change in [%]", side=4, line=3)
