[R] Manual scaling a scatter plot

osiander@24on.cc osiander at 24on.cc
Fri May 31 18:28:00 CEST 2002

Hello R-help,
I have a data.frame where I want to scatterplot variable1 versus variable2 using a third variable as a factor. For each factor I want to have a regression line in the same plot with different color and symbols. Var1, and var2  contain a lot of NA,sometimes the dependent var sometimes the predictor, sometimes both together.

Three problems occure:

Makeing subsets to split the data according to the levels is tedious and needs then points(), abline(lm()) with different line and points types for each plot defined manualy.
Is there a simpler solution?

Since the data need different scaling some datapoints lay outside of the window, depending on which level was printed first. Is there a way to do scaling manualy? 

I start with a plot of the vars with the bigger range using the plot(type="n") function. Then I do several plot( add=T). If the biggest positive value in the predictor(x-axis) matches with a NA on the y-axis, the auto-scaling still takes the biggest positive value. The final plot then has an empty right part, which looks unprofessional. Is manual scaling an option here? I can not easily work with na.omit etc, since there are more variables which have valid data I do not want to loose.

Thank you,
osiander at 24on.cc

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list