plotyy(x1, y1, x2, y2, gridp = TRUE, box.col = "grey",
type = "l", lwd = 1, lty = 1,
xlab = "x", ylab = "y", main = "",
col.y1 = "navy", col.y2 = "maroon", ...)
y1
versus x1
with y-axis labeling on the left and plots
y2
versus x2
with y-axis labeling on the right. The x-values should not be too far appart. To exclude certain points, use
NA
values. Both curves will be line or point plots, and have the
same line type and width.
plotrix::twoord.plot
x <- seq(0, 20, by = 0.01)
y1 <- 200*exp(-0.05*x)*sin(x)
y2 <- 0.8*exp(-0.5*x)*sin(10*x)
plotyy(x, y1, x, y2, main = "Two-ordinates Plot")
Run the code above in your browser using DataLab