If I have three sets of data :
a1= rnorm(10)
a2= rnorm(10)
a3= rnorm(10)
rather than looking at these side by side using:
par(mfrow=c(1,3))
plot(a1)
plot(a2)
plot(a3)
How do I get all these points on the same plot?
Just use the points
function:
plot(a1)
points(a2, col=2)
points(a3, col=3)
This is equivilent to:
plot(1:length(a1), a1)
points(1:length(a2), a2, col=2)
points(1:length(a3), a3, col=3)
If the vectors have unequal lengths, then you should specify the x-axis limit:
plot(a1, xlim=c(1, max(length(a1), length(a2), length(a3))))