Skip to content
Prev 44764 / 398503 Next

r: plots

On Tue, 24 Feb 2004 14:44:47 +0200, allan clark
<allan at stats.uct.ac.za> wrote :
You need to do most of the work yourself:

par(mar=par('mar')+c(0,0,0,2))  # make room for the extra axis 
plot(1:5, x, ylim = c(0, 200)) # plot x with room for the others
points(1:5, y, pch=2) # plot y
points(1:5, 200*z, pch=3) # plot z, magnified 200 times
zticks <- pretty(z) # choose ticks for z
axis(4, at=200*zticks, labels=zticks) # plot them
mtext('z',side=4, line=3) # add the z label

You'll also want to add a legend, but I'll let you figure that out.

Duncan Murdoch