graphics.off() #erases previous graphics x=seq(.4,4,.1); y=log(x^2+1/x^2) plot(x,y,type="p") #p for points plot(x,y,type="l") #l for line plot(x,y,type="s") #l for step plot(x,y,type="p",pch=2) #pch : type of points ##ylim=c(ay,by), xlim=c(ax,bx) : bounds of the axes ##lty : type of line, col : color, main : title x=rnorm (20); y=rexp (20) plot(x,y,col="red",ylim=c(-0.5 , 5),xlim=c(-3,2)) points(x+.5,y-1,pch=2,col="blue") #add points legend("topleft",c("plot_1","plot_2"),col=c("red","blue"), pch=c(1,2)) lines(x,y, lty=2, col="green") #add line abline (h=3,col="yellow",lty=1)#add horizontal line abline (v=-1.3,col="aquamarine2")#add vertical line abline (a=1,b=1,col="coral3")#add oblique line text(-2,2 ,"commentary");title("Example curves")