[R-sig-Geo] Add title to rastervis levelplot

Oscar Perpiñan Lamigueiro oscar.perpinan at upm.es
Wed Jan 25 13:32:31 CET 2012


Hello,

You have found a bug. Although "main" is an explicit argument for
levelplot, it is not being used inside the method. I will fix it and
update the version at R-Forge today. 

For annotations inside the plot you can use the combination of layer
(from latticeExtra) and panel.text functions:

library(raster)
library(rasterVis)
library(latticeExtra)

r <- raster(volcano)
levelplot(r) + layer(panel.text(0.9, 0.9, 'Volcano'))

Thanks for the info.

Best,

Oscar.


-------------------
Oscar Perpiñán Lamigueiro
Dpto. Ingeniería Eléctrica
EUITI-UPM

http://procomun.wordpress.com

-----------------------------------------
>Hi list,
>
>I'd like to add a title to a level plot from rasterVis package but I
>couldn't find how. There are no examples of this on the rastervis page.
>I'm not very familiar with lattice kung fu, but I've tried :
>
>library(raster)
>library(rasterVis)
>r <- raster(volcano)
>levelplot(r, margin = FALSE, main = "The Great Volcano")
># or
>levelplot(r, margin = FALSE, main = list("The Great Volcano"))
>
>Any other way of adding an anotation to that plot would be welcome as
>well.
>
>Thanks,
>Etienne
>
>	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list