allan clark wrote:

hi all

i have another probably simple question.

I have three variables say x, y and z. x and y are quite large and z is
relative small.
how can one plot the three variables on the same graph with two separate
axis?
(one for x and y and the other for z)

e.g.

x<-c(101,110,150,167,120) y<-c(120,135,175,95,200) z<-c(0.001, 0.15, 0.6, 0.8, 1)


## Try something like:


fac <- 200

par(mar=c(5,4,4,5)+.1)

plot(x, ylim=range(c(x, y, fac * z)), col="blue", ylab="x, y")
points(y, col="green")
points(z*fac, col="red")

axis(4, at=pretty(z*fac), label=pretty(z*fac)/fac, ylab="z")
mtext("z", side=4, line=2.5)

# more about this see ?axis, ?pretty and ?mtext

Thomas P.

--
Thomas Petzoldt
Dresden University of Technology
Institute of Hydrobiology          [EMAIL PROTECTED]
01062 Dresden                      http://www.tu-dresden.de/fghhihb/

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

Reply via email to