Skip to content

Instantly share code, notes, and snippets.

@1beb
Created May 26, 2011 20:41
Show Gist options
  • Save 1beb/994029 to your computer and use it in GitHub Desktop.
Save 1beb/994029 to your computer and use it in GitHub Desktop.
Double Y Axis Plots with Base
x <- rnorm(100)*20
y <- rnorm(100)*40
plot(1:100, x, type="l", col="blue", xlab="X axis label", ylab="Left legend")
par(new=TRUE)
plot(1:100, y, type="l", ann=FALSE, yaxt="n")
axis(4)
legend(x="topleft", bty="n", lty=c(1,1), col=c("blue","black"), legend=c("Left", "Right"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment