Quantcast
Channel: Plot two graphs in a same plot - Stack Overflow
Viewing all articles
Browse latest Browse all 18

Answer by Varn K for Plot two graphs in a same plot

$
0
0

we can also use lattice library

library(lattice)x <- seq(-2,2,0.05)y1 <- pnorm(x)y2 <- pnorm(x,1,1)xyplot(y1 + y2 ~ x, ylab = "y1 and y2", type = "l", auto.key = list(points = FALSE,lines = TRUE))

For specific colors

xyplot(y1 + y2 ~ x,ylab = "y1 and y2", type = "l", auto.key = list(points = F,lines = T), par.settings = list(superpose.line = list(col = c("red","green"))))

enter image description here


Viewing all articles
Browse latest Browse all 18

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>