Was it helpful?

Question

How to create two line charts in the same plot in R?

R ProgrammingServer Side ProgrammingProgramming

We can do this by using lines function after plotting the first chart.

Example

> x <- seq(-3, 3, 0.025)
> X1 <- pnorm(x)
> X2 <- pnorm(x, 2, 1)
> plot(x, X1, type="l",col="red", ylab="X")
> lines(x, X2, col="green")


raja
Published on 06-Jul-2020 16:14:49
Advertisements
Was it helpful?
Not affiliated with Tutorialspoint
scroll top