When I try to plot two lines ( or scatterplots) with different scales, this
is what I have been doing:

Suppose: I have y1 and y2 in a very different scale

y1 = 1:100
y2 = c(100:1)*10

To plot them on top of each other  and denote by different colors: I have to
figure out the correct scale '10'  and corresponding tick.vector and lables.
Then do:

plot(1:100, y1)   # I can have 'ylab' here for the left-hand side y axis.
points(1:100, y2/10,col=2)
ytick.vector = seq(from=0,to=100,by=20)
ytick.label = as.character(seq(from=0,to=1000,by=200))
axis(4,at = ytick.vector,label = ytick.label,col=2,col.axis=2)

Two questions.

1. Are there easier ways to plot the y1, y2 w/o figuring out the correct
scaler, tick vectors, and labels in order to put them in one figure?
2. How to add additional 'ylab' to the right hand side y-axis of the plot?
Thanks a lot!

-Young

        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to