[R] two plots in one frame
Mark Myatt
mark at myatt.demon.co.uk
Mon Nov 19 11:23:12 CET 2001
Achim Zeileis <zeileis at ci.tuwien.ac.at> writes:
>Justin Fay wrote:
>>
>> I would like to plot two different scatterplots in the same frame (say with
>> different colors) but everytime plot is called a new frame is created. Is
>> there a way around this?
>
>try points()
>or par(new=TRUE)
You might get an axes scaling problem if the range of the two datasets
are different. To get over this set xlim and ylim on the first call to
plot ... something like:
plot(x1, y1, xlim = c(min(x1, x2), max(x1, x2)),
ylim = c(min(y1, y2), max(y1, y2)), col = "red")
points(x2, y2, col = "blue")
You could replace min() and max() with range().
Mark
--
Mark Myatt
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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