[R-sig-Geo] colors (and other issues) in rasterVis()
Oscar Perpiñán Lamigueiro
oscar.perpinan at gmail.com
Fri May 3 15:59:44 CEST 2013
Hello,
1.- Use names.attr to define the labels of each panel if they are
different from the layers names.
2.- The axes can be customized with scales. To suppress them completely
use scales=list(draw=FALSE).
3.- The colors are defined with col.regions (you were using col.region)
or par.settings. There are some examples with par.settings and
predefined themes here: http://rastervis.r-forge.r-project.org/#themes.
I will improve the documentation to clarify this point.
This code should work for your three requirements:
r <- raster(nrow=10, ncol=10)
r[] <- runif(100)
s <- stack(lapply(1:8, function(i)r))
levelplot(s, scales=list(draw=FALSE), colorkey=FALSE,
col.regions=gray.colors(128,gamma=0.5),
names.attr=paste0('MNF-', 1:8))
myTheme <- rasterTheme(region=gray.colors(128,gamma=0.5))
levelplot(s, scales=list(draw=FALSE), colorkey=FALSE,
par.settings=myTheme,
names.attr=paste0('MNF-', 1:8))
levelplot(s, scales=list(draw=FALSE), colorkey=FALSE,
par.settings=GrTheme(),
names.attr=paste0('MNF-', 1:8))
Best,
Oscar.
Agustin Lobo <alobolistas at gmail.com> writes:
> Hi!
> I do not get to plot a set of 8 raster layers from a brick the way I
> want with rasterVis()
> I do:
> require(rasterVis)
> levelplot(adlsEMNFVIS[[1:8]],axes=FALSE,colorkey=FALSE,col.region=gray.colors(128,gamma=0.5))
>
> I want to:
> 1. Do not plot the names of the layers or plot a different text. i.e.
> paste("MNF-",1:8,sep="")
> 2. Do not plot the axes or at least the axes text (the numbers).
> 3. Use a grey scale.
>
> I've gone through the man page and I think that I should use
> par.settings=, but the help page
> links to another page and that one to another... and finally get lost.
>
> Any help appreciated!
>
> Thanks
>
> _______________________________________________
> 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
Grupo de Sistemas Fotovoltaicos (IES-UPM)
Dpto. Ingeniería Eléctrica (EUITI-UPM)
URL: http://procomun.wordpress.com
Twitter: @oscarperpinan
More information about the R-sig-Geo
mailing list