0

I am using the function densityplot() and grid.arrange(), this is the example:

library(rasterVis)
library(gridExtra)
library(raster)

f <- system.file("external/test.grd", package="raster")
r <- raster(f)
data<-stack(r,r*2,r/3,r+100,r,r*2,r*2,r/3,r+100,r,r-10,r)
names(data) <- month.abb
a<- densityplot(data[[1:3]],main="title 1")
b<- densityplot(data[[4:6]],main="title 2")
c<- densityplot(data[[7:9]],main="title 3")
d<- densityplot(data[[10:12]],main="title 4")

grid.arrange(a,b,c,d,ncol=2,top="main title ")

Using this code my output is:

output 1

No show "title 1", "title 2" .... and the output using with my data is:

output 2

equal does not display the main title of the densityplot and the label ("Jan" "Feb" "Mar" "Apr" ....)

It is possible that can guide me please.

thank you!!

rral
  • 554
  • 3
  • 20
  • 1
    it's hard to tell without data, you should make your example reproducible. Also, why do you have the raster tags? – baptiste Sep 02 '15 at 00:54
  • Thanks for your reply. I modified a reproducible example – rral Sep 02 '15 at 05:21
  • none of the individual plots have titles, my guess is that it's a bug in the `RasterLayer` method for `densityplot` defined in `rasterVis` – baptiste Sep 02 '15 at 07:06
  • 2
    @baptiste you are right. Fixed [now](https://github.com/oscarperpinan/rastervis/commit/62f42a1b58f2f697dfdeafd4a055a407118952e5). @user25418 you will have to install the package again with `devtools::install_github('oscarperpinan/rasterVis')`. – Oscar Perpiñán Sep 03 '15 at 06:43

0 Answers0