[R] overlay xyplot on contourplot in lattice in R

Deepayan Sarkar deepayan.sarkar at gmail.com
Mon Jan 29 21:01:01 CET 2007


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.
>



More information about the R-help mailing list