First of all, thanks to everyone who answers these questions - it's most helpful. I'm new to R and despite searching have not found an example of what I want to do (there are some good beginner's guides and a lot of complex plots, but I haven't found this). I would like to plot two variables against the same abscissa values. They have different scales. I've found how to make a second axis on the right for labeling, but not how to plot two lines at different scales. Thanks, - Rick rc at ece.pdx.edu
On Mon, 24-Aug-2009 at 08:00AM -0700, Rick wrote:> > First of all, thanks to everyone who answers these questions - it's > most helpful. > > I'm new to R and despite searching have not found an example of what I > want to do (there are some good beginner's guides and a lot of complex > plots, but I haven't found this). > > I would like to plot two variables against the same abscissa values. They > have different scales. I've found how to make a second axis on the right > for labeling, but not how to plot two lines at different scales.The idea is that you rescale the second lot of y values to fit into the same range as the first lot. If your first ones range from 0 to 10 and your second ones from 0 to 1000, you do the second line (using the lines() function) by dividing every value by 100 and I think you will have found how to use axis with side = 3 to do the axis. If the zeros don't coincide, you need to make further adjustments which should become obvious. HTH -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___ Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) ..... Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
On Aug 24, 2009, at 11:00 AM, Rick wrote:> > First of all, thanks to everyone who answers these questions - it's > most helpful. > > I'm new to R and despite searching have not found an example of what I > want to do (there are some good beginner's guides and a lot of complex > plots, but I haven't found this). > > I would like to plot two variables against the same abscissa values. > They > have different scales. I've found how to make a second axis on the > right > for labeling, but not how to plot two lines at different scales.After using R site search I would ask: have you looked at as.layer in {latticeExtra}? David Winsemius, MD Heritage Laboratories West Hartford, CT
On 25/08/2009, at 3:00 AM, Rick wrote:> > First of all, thanks to everyone who answers these questions - it's > most helpful. > > I'm new to R and despite searching have not found an example of what I > want to do (there are some good beginner's guides and a lot of complex > plots, but I haven't found this). > > I would like to plot two variables against the same abscissa > values. They > have different scales. I've found how to make a second axis on the > right > for labeling, but not how to plot two lines at different scales.(1) First of all ***DON'T*** do it! It's very bad graphical practice and will mislead the viewer with probability 1. (2) If you bloody-mindedly ***insist*** on doing it, see: http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-base:2yaxes cheers, Rolf Turner ###################################################################### Attention:\ This e-mail message is privileged and confid...{{dropped:9}}