How to plot two graphs in same plot in R? lines() or points() will add to the existing graph, but will not create a new window. So you’d need to do
1 2 3 | plot(x,y1,type="l",col="red") lines(x,y2,col="green") |
Final graph will looks like:
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.