[R] overlapping plots

partha_bagchi@hgsi.com partha_bagchi at hgsi.com
Mon Nov 1 22:52:31 CET 2004


Use a judicious combination of par(mai) and par(new = TRUE). For example:

par(mai = c(3,1,1,1))
x <- runif(50)
plot(x, xlim = c(1, 500), ylim = c( -5, 1), bty = "l")

par(mai = c(2,1.5,2,1))
par(new = TRUE)
x <- runif(50)
plot(x, xlim = c(1, 500), ylim = c( -5, 1), bty = "l")

par(mai = c(1,2,3,1))
par(new = TRUE)
x <- runif(50)
plot(x, xlim = c(1, 500), ylim = c( -5, 1), bty = "l")

Does that help?

Partha






"Carlisle Thacker" <Carlisle.Thacker at noaa.gov>
Sent by: r-help-bounces at stat.math.ethz.ch
11/01/2004 04:09 PM

 
        To:     r-help at stat.math.ethz.ch
        cc: 
        Subject:        [R] overlapping plots


How to combine three plots so that they partially overlap?  As the data
on all three are near the left side and top, it would be nice to draw
the first, shift axes down and to the right and draw the second, and
shift again to draw the third.

I could shift the data for the 2nd and 3rd plots and construct their
axes by hand, but it would be great if R has an easier way.

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




More information about the R-help mailing list