Kathy-Andrée Laplante-Albert
2007-Jan-29 19:34 UTC
[R] overlay xyplot on contourplot in lattice in R
Hi everybody, I want to do a contourplot in lattice with my raw data overlaid on it(xyplot) which seemed to be a very easy thing to do. I've tried it in many ways, but I haven't succeeded at obtaining it. let's say x, y, and z as the variables that comes from the data frame ''ex'': therefore my countourplot is as followed : contourplot(z ~ x * y, cuts=550) I would like then to overalay on it xx and yy (same variables as x and y but in another data frame let's say ''example'') xyplot(example$xx, example$yy) How can I do it? It seems I could do it with the panel.contourplot and panel.xyplot options, but until now I haven't suceeded. I found this command that maybe could help me : # contourplot contourplot(elev ~ longitude * latitude, data = interpgrid, panel = function(x, y, subscripts, ...) { panel.contourplot(x, y, subscripts, ...) panel.xyplot(ortann$longitude, ortann$latitude) } ) however, doesn't seem to work out, and I do not know what should I write for subscripts. I do not understand the explanation in R. Is anyone could help me? Thanks a lot in advance! I use R, version 2.4.0. Kathy-Andr?e Laplante-Albert ?tudiante ? la ma?trise Groupe de Recherche sur les ?cosyst?mes Aquatiques Universit? du Qu?bec ? Trois-Rivi?res C.P. 500, Trois-Rivi?res (Qu?bec) Canada ------------------------------------------------- Courriel exp?di? via https://courriel.uqtr.ca
On 1/29/07, Kathy-Andr?e Laplante-Albert <Kathy-Andree.Laplante-Albert at uqtr.ca> wrote:> > > Hi everybody, > > I want to do a contourplot in lattice with my raw data overlaid on it(xyplot) > which seemed to be a very easy thing to do. > > I've tried it in many ways, but I haven't succeeded at obtaining it. > > let's say x, y, and z as the variables that comes from the data frame ''ex'': > > therefore my countourplot is as followed : > > contourplot(z ~ x * y, cuts=550) > > I would like then to overalay on it xx and yy (same variables as x and y but in > another data frame let's say ''example'') > > xyplot(example$xx, example$yy) > > How can I do it? > > It seems I could do it with the panel.contourplot and panel.xyplot options, but > until now I haven't suceeded. I found this command that maybe could help me : > > > # contourplot > contourplot(elev ~ longitude * latitude, data = interpgrid, > panel = function(x, y, subscripts, ...) { > panel.contourplot(x, y, subscripts, ...) > panel.xyplot(ortann$longitude, ortann$latitude) > } )This looks like something that should work. Could you explain why it "doesn't seem to work out"? -Deepayan> however, doesn't seem to work out, and I do not know what should I write for > subscripts. I do not understand the explanation in R. > > Is anyone could help me? > > Thanks a lot in advance! > > I use R, version 2.4.0. > > Kathy-Andr?e Laplante-Albert > ?tudiante ? la ma?trise > Groupe de Recherche sur les ?cosyst?mes Aquatiques > Universit? du Qu?bec ? Trois-Rivi?res > C.P. 500, Trois-Rivi?res (Qu?bec) Canada > > ------------------------------------------------- > Courriel exp?di? via https://courriel.uqtr.ca > > ______________________________________________ > 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 > and provide commented, minimal, self-contained, reproducible code. >