[R-sig-Geo] title in plot of raster::stack or brick objects

Jose jmprietob at gmail.com
Fri Nov 20 10:42:55 CET 2015


Hello,
try with title():

r <- raster(nrows=10, ncols=10)
r <- setValues(r, 1:ncell(r))
s <- stack(r, sqrt(r), r/sqrt(r))
names(s) <- paste0("S",1:3)
plot(s)
title("Title", line=3)

Best

______________________________________
José Manuel Prieto
https://jmprietob.shinyapps.io/eltiempo/
es.linkedin.com/in/josemanuelprietoblazquez/

2015-11-20 10:34 GMT+01:00 Agustin Lobo <alobolistas at gmail.com>:

> Given
> r <- raster(nrows=10, ncols=10)
> r <- setValues(r, 1:ncell(r))
> s <- stack(r, sqrt(r), r/sqrt(r))
> names(s) <- paste0("S",1:3)
> plot(s)
>
> Is there any way to put a main title centered on the multiple plot and
> get the names of the layers displayed as well?
>
> plot(s, main="S")
> puts the title for the 1st layer only and eliminates the names of the
> layers from the plot
>
> Thanks
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list