Skip to content
Back to formatted view

Raw Message

Message-ID: <1232404991.7716.11.camel@Virgilio-Gomez>
Date: 2009-01-19T22:43:11Z
From: Virgilio Gomez Rubio
Subject: contour lines on a plot
In-Reply-To: <4974EE58.2050507@ub.edu>

Hi,
El lun, 19-01-2009 a las 22:19 +0100, Jos? Manuel Blanco Moreno
escribi?:
> Just a doubt... there seems that the contours are not shifted but 
> "mirrored" (flipped) along an horizontal line?

Very well spotted!!

The right code should be as follows (the change is in the definition of
'spvolcano'):

library(maptools)

x <- 10*1:nrow(volcano)
y <- 10*1:ncol(volcano)
clv<-contourLines(x, y, volcano)

res <- ContourLines2SLDF(clv)

grd<-GridTopology(c(0,0), c(10, 10), dim(volcano))
spvolcano<-SpatialGridDataFrame(grd, 
   data.frame(altitude=as.vector((volcano[,ncol(volcano):1]))))

spplot(spvolcano, sp.layout=list(list("sp.lines", res)) )



Best,

Virgilio