[R] R-help

Rob Steele rob at fatkat.com
Tue Feb 22 16:08:01 CET 2005


> I am tring to create a plot with two y-axis.
> I found an example which is fine but the problem is that the range of
> the second y-axes appears in the first y-axes causing confusion. [...]

The key is the "ann = FALSE" in the second plot():

n = 100
x = rnorm(n)
y = rnorm(n)
z = rnorm(n) * 250

par(mar = c(5, 4, 4, 5) + 0.1)
plot(x, y, ann = FALSE)

par(new = TRUE)
plot(x, z, col = 'blue', axes = FALSE, ann = FALSE)
axis(side = 4, col.axis = 'blue')

title(xlab = 'x', ylab = 'y')
mtext('z', side = 4, line = 3)




More information about the R-help mailing list