my.line.plot <- function(x, y, ...)
{
## Purpose: Template function for making lines by group.
## Arguments:
## x: X-coords
## y: a matrix with Y-coords (each column has a set of Y values)
## ...: passed to "plot"
## Return: A plot assuming log X-axis with axes tickes given by "x".
## Author: Feiming Chen, Date: 9 Feb 2017, 14:02
## ________________________________________________n
N <- ncol(y) # number of lines
matplot(x, y, type="b", log="x", xaxt="n", lwd=2, lty=seq(N), col = rainbow(N), ...)
matpoints(x, y, log="x", xaxt="n", col = "black", ...)
axis(1, at=x)
}
if (F) { # Unit Test
x <- c(0.1, 1, 10)
y <- matrix(rnorm(9), 3)
my.line.plot(x, y, xlab="Tiime", ylab="Signal", main="Line Plot by Groups")
}
No comments:
Post a Comment