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)

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to