Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple Plots in the Same Figure [R]

I would like to plot two functions f1 and f2 on the same graph. With the following code, I found that the scale of the y axes for the two plots are different. Is there a way to make the scales same?

plot(f1, 0, 1)
par(new=TRUE)
plot(f2, 0, 1)
like image 476
Tim Avatar asked Oct 23 '22 09:10

Tim


1 Answers

Use the curve function:

plot(f1, 0, 1)
curve(f2, 0, 1, add=TRUE)
like image 168
Rob Hyndman Avatar answered Oct 27 '22 11:10

Rob Hyndman