Superimposing two plots

· GNU-R, Graphics

If you want to give two plot commands, and do not want the second one to wipe out the first one, do the following.


plot(first plot)




plot(second plot)


This will superimpose the second plot on the first. Note that the two plots may have different scales. To ensure that they use a particular (say, same) scale, set ylim and xlim in both the graphs. If you are using the same scales, you may want to turn off axes and labels in the second plot. Otherwise, they will be printed again.

%d bloggers like this: