[R] Combing xyplot and curve() plot via print

Afshartous, David DAfshartous at med.miami.edu
Mon Nov 10 16:50:53 CET 2008


All,

I'm trying to put an xyplot and a plot produced via curve() on the same
page.  It seems that mfrow and layout don't work, and now I'm trying print
but that does not work either.  Any suggestions much appreciated.

Cheers,
David

p.11 = xyplot(1:10 ~ 1:10)

curve(sin, 0,3, ylim=c(-3,3), ylab="sin and cos",  lty = 1)
curve(cos, 0,3,  ylim=c(-3,3), lty = 5, add=TRUE)
legend(2,2, legend = "legend here")
p.12 = recordPlot()

print(p.11, split = c(1,1, 2,1), more = T)
print(p.12, split=c(2,1,2,1), more = T  )





> sessionInfo()
R version 2.7.1 (2008-06-23)
i386-apple-darwin8.10.1

locale:
en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] lattice_0.17-8

loaded via a namespace (and not attached):
[1] Matrix_0.999375-11 grid_2.7.1         lme4_0.999375-24   nlme_3.1-89
> 



More information about the R-help mailing list