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

Agustin Lobo alobolistas at gmail.com
Fri Nov 20 10:51:09 CET 2015


Thanks. Not great though, as the actual position depends on
the shape of the of the display . I.e., if you are on RStudio, open
the zoom window and the main title gets lower than the names of the
layers.

Perhaps the problem would be alleviated if raster::plot() could display
layer names as subtitles (at the bottom of the layers). That would leave more
room for the main title at the main top.

Agus

On Fri, Nov 20, 2015 at 10:42 AM, Jose <jmprietob at gmail.com> wrote:
> 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]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list