An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20140128/e9d0dfe6/attachment.pl>
rastervVis : adding point locations to a hovmoller plot
2 messages · Don Carlos, Oscar Perpiñan
1 day later
Hello,
The easiest solution is using the +.trellis function provided by the
latticeExtra package (automatically loaded with rasterVis). I have
modified a bit your example to show the usage:
idx <- seq(as.Date('2008-01-15'), as.Date('2008-3-15'), 'month')
SISmm <- setZ(St, idx)
hov <- hovmoller(SISmm, contour=FALSE, panel=panel.levelplot.raster,
yscale.components=yscale.raster.subticks,
interpolate=TRUE,
par.settings=RdBuTheme)
#location data in decimal degrees. these are the points I want to add onto the hovmoller plot
x <- c(50 , 25, 0)
date <- as.Date(c('2008-01-15', '2008-02-15','2008-03-15'))
loc <- data.frame(x, date)
## Here we use +.trellis to overlay the points
hov + xyplot(date ~ x, data=loc)
Best,
Oscar.
Don Carlos writes:
Dear r sig geo users,
I trying to add location points (longitude-time) onto a hovmoller plot
(rasterVis). These are locations of objects at given longitude and time.
An example of what I want to do here
library("rasterVis")
library("lattice")
r <- raster(nrows=10, ncols=10)
r <- setValues(r, 1:ncell(r))
r1 <- raster(nrows=10, ncols=10)
r1 <- setValues(r1, 1:ncell(r))
r2 <- raster(nrows=10, ncols=10)
r2 <- setValues(r2, 1:ncell(r))
St=stack(r,r1,r2)
idx <- seq(as.Date('2008-01-15'), as.Date('2008-1-17'), 'day')
SISmm <- setZ(St, idx)
hov<-hovmoller(SISmm, contour=FALSE, panel=panel.levelplot.raster,
yscale.components=yscale.
raster.subticks,interpolate=TRUE,
par.settings=RdBuTheme)
#location data in decimal degrees. these are the points I want to add onto
the hovmoller plot
x<-c(50.00000,25.00000,0.00000)
date<-as.Date('2008-01-15', '2008-01-15','2008-01-17')
loc<-data.frame(x,date)
#attempt to overlay the location onto the hov plot. This is clearly not the
correct approach but I am still at the very bottom of the R learning
curve...
plot(hov, position=c(0,0,1,1))
plot(loc,position=c(0,0,1,1),newpage=F)
Thankful for any pointers or suggestions.
Regards,
Don
[[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Oscar Perpi??n Lamigueiro Dpto. Ingenier?a El?ctrica (ETSIDI-UPM) Grupo de Sistemas Fotovoltaicos (IES-UPM) URL: http://oscarperpinan.github.io Twitter: @oscarperpinan