Etiquetas
The raster package defines classes and methods for spatial raster data access and manipulation. The new rasterVis package complements raster providing a set of methods for enhanced visualization and interaction. It is now at CRAN.
Several examples can be found at the webpage of the project.

Teepe dijo:
Hello,
A new question about rasterVis ! My problem is about hovmoller function. It works well but is there a way to fill contour lines with color rather than to plot big colored squares.
Thank you !
Oscar Perpiñán Lamigueiro dijo:
Hello,
I am not sure if I understand your question. Could you give me an example with code? Besides, tell me the rasterVis version you are using.
Oscar.
Oscar Perpiñán Lamigueiro dijo:
Hi again.
I finally understood what you were talking about. There is an easy solution with the panel.2dsmoother function of the latticeExtra package. Using the SISmm data of the example from the hovmoller help page:
hovmoller(SISmm, panel=panel.2dsmoother, n=1000, add.contour=TRUE)
You should modify n to adjust the smoothness of the color regions.
Oscar.
Teepe dijo:
Hello,
I’m very sorry for the late reply (very busy this month).
Nevertheless once again it is indeed exactly what I need.
Thank you very much !
Teepe dijo:
Hello,
I have a question about levelplot. I use levelplot in the same fashion of your example : levelplot(SISmm) (12 panels for 12 months). Nevertheless when I use postscript () or png() font size is too small for me.
I succeed to increase font size for axis labels but I really don’t know how to increase font for panel names. Do you have an idea ?
Oscar Perpiñán Lamigueiro dijo:
Hi,
You can change them with strip.custom (see help(strip.custom) for details). For example:
levelplot(SISmm, strip=strip.custom(par.strip.text=list(cex=2)))
Or you can define a modified theme:
myTheme <- modifyList(rasterTheme(), list(add.text=list(cex=2)))
levelplot(SISmm, par.settings=myTheme)
Best
Oscar.
Teepe dijo:
Thank a lot. Your package+raster package help me a lot for my research.
Oscar Perpiñán Lamigueiro dijo:
Good. Thanks for your positive feedback.
pauldassori dijo:
Felicitaciones a los autores Oscar Perpiñán Lamigueiro y Robert Hijmans
No conocía esta librería y le he encontrado excelente y práctica!!…La difundo
¿Alguna forma de unir la función histogram() y densityplot() en una sola gráfica?
Gracias y saludos desde el Sur de Chile.
Valdivia.
Oscar Perpiñán Lamigueiro dijo:
Gracias!
Para representar en una gráfica la densidad y el histograma hay que definir un panel a medida:
denshist <- function(x, na.rm=TRUE, n=100, ...){
panel.histogram(x, ...)
panel.densityplot(x, darg=list(na.rm=na.rm, n=n), col.line='black', ...)
}
Por ejemplo:
f <- system.file("external/test.grd", package="raster")
r <- raster(f)
histogram(r, panel=denshist)
Si lo que necesitas es representar la densidad y el histograma en paneles diferentes tendrás que usar
c.trellisdelatticeExtra:d <- densityplot(r)
h <- histogram(r)
c(d, h)