Dear all,

Does anyone know a way to overlay a contourplot and a levelplot of
different datasets, both datasets with the same dimension?

Let's say I have 2 10x10 grids, like those below:

library(lattice)

x<-1:10
y<-1:10
grid1<-expand.grid(x=x,y=y)
grid2<-expand.grid(x=x,y=y)
z1<-grid1$x^2 + grid1$y^2
z2<-2*grid2$x^2 - grid2$y^2
grid1$z<-z1
grid2$z<-z2

I would like to plot z1 and z2 in the same plot: z1 as a contourline and z2
as a levelplot. I tried to do this in two ways, without success:

plot.new();
contourplot(z ~ x*y,grid1)
par(new=T)
levelplot(z ~ x*y,grid2)

and

levelplot(z ~ x*y,grid1,region=FALSE,contour=TRUE)
par(new=T)
levelplot(z ~ x*y,grid2,region=TRUE,contour=FALSE)

Any clue?

Thank you very much for your time and any help!

Charles

-- 
Um axé! :)

--
Charles Novaes de Santana, PhD
http://www.imedea.uib-csic.es/~charles

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to