Skip to content

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: