# Create sample data
x <- c(1,2,3,4,5,6,7,8,9,10)
y1 <-c(2,5,2,8,6,8,3,4,2,4)
y2 <-c(2,5,3,7,5,9,7,9,4,1)
# Draw first plot using axis y1
par(mar = c(7, 3, 5, 4) + 0.3)
plot(x, y1, type="l", col = 2)
# set parameter new=True for a new axis
par(new = TRUE)
# Draw second plot using axis y2
plot(x, y2, type="l", col = 3, axes = FALSE, xlab = "", ylab = "")
axis(side = 4, at = pretty(range(y2)))
mtext("y2", side = 4, line = 3)