[R-sig-Geo] rasterVis::levelplot key='top' error

Jonathan j2kennel at gmail.com
Thu Oct 4 18:27:51 CEST 2012


Hello all,

I'm using rasterVis to plot point and raster data together and am finding an
error when trying to put a manually defined key on the top of the plot.  It
works on the 'left' and 'bottom' axes but not on the top or right.  Can
others reproduce this error and what is a possible solution? 

I'm using:
raster_2.0-12 
rasterVis_0.11-01

Here is the example code.  Thank you!
Jonathan

# EXAMPLE CODE
library(raster)
library(rasterVis)

RST <- raster()
RST[] <- 1

# key on top-this doesn't works!
levelplot(RST,
          region = FALSE,
          key = list(space = 'top',
                     points = list(col = 'black',
                                   type = 'p',
                                   pch = 20),
                     text = list('test')))
 
#Error in fun(key = list(space = "top", points = list(col = "black", type =
"p",  : 
#  argument "p" is missing, with no default
                                                     
# key on bottom-this works!
levelplot(RST, 
          region = FALSE,
          key = list(space = 'bottom',
                     points = list(col = 'black',
                                   type = 'p',
                                   pch = 20),
                     text = list('test')))

# key on top with standard levelplot for matrix-this works!
levelplot(as.matrix(RST),
          region = FALSE, 
          key = list(space = 'top',
                     points = list(col = 'black',
                                   type = 'p',
                                   pch = 20),
                     text = list('test')))


sessionInfo()
#R version 2.15.1 (2012-06-22)
#Platform: x86_64-unknown-linux-gnu (64-bit)

#locale:
#  [1] LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C              
#[3] LC_TIME=en_CA.UTF-8        LC_COLLATE=en_CA.UTF-8    
# [5] LC_MONETARY=en_CA.UTF-8    LC_MESSAGES=en_CA.UTF-8   
# [7] LC_PAPER=C                 LC_NAME=C                 
# [9] LC_ADDRESS=C               LC_TELEPHONE=C            
# [11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C       
# 
# attached base packages:
#   [1] grid      stats     graphics  grDevices utils     datasets  methods  
# [8] base     
# 
# other attached packages:
#   [1] rasterVis_0.11-01   hexbin_1.26.0       latticeExtra_0.6-24
# [4] RColorBrewer_1.0-5  lattice_0.20-10     raster_2.0-12      
# [7] sp_0.9-99          
# 
# loaded via a namespace (and not attached):
#   [1] zoo_1.7-7




--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/rasterVis-levelplot-key-top-error-tp7581134.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list