[R] superposing lattice plots

jiho jo.irisson at gmail.com
Fri Aug 17 16:25:27 CEST 2007

Hello everyone,

I am sorry if this has already been asked but I can't find it. I want  
to superpose two lattice plots, namely a levelplot and a contourplot  
of two different variables with the same x-y scale. I found  
information about panel.superpose but it does not seem to correspond  
to what I want (I have two different variables, not groups of the  
same variable)

How can I do this? Is there a way to concatenate the two trellis  
objects and plot that?

Simple example using simulated data:


I would like both plots to appear superposed.

PS: accessory question, for the enthusiast ;). When data in contained  
in a matrix and x-y coordinates in separate vectors, as above, is  
there a way to get level/contourplot to use x and y as the  
coordinates vectors other than by "unrolling" the matrix in a  
x	y	mat
1	1	0.125
1	2	0.1367
1	3	0.2345
and using mat ~ x*y ?

Thank you in advance. Sincerely,


More information about the R-help mailing list