I am working on change detection and have been able to visualize the results that I have created through levelplot. Previously I used to use Writeraster
for storing my plots as tif
files which did not manipulated my data in terms of pixel width or height. With levelplot, I am unable to use this function,as it throws error missing trellis, character function
.
How can I save a levelpot as a TIFF imagery without legends to be opened in QGIS so that I can overlay it over basemaps?
Here is how I am creating levelplot:
changeDet1 <- calc(stack(lc1,lc2), fun = change)
codes_ <- data.frame(ID = grid_$code,value = paste0('from ',grid_[,1],' to ',grid_[,2]))
logical_test <- which(grid_$change == T) # remove no change classes
codes_ <- codes_[logical_test,]
codes_
a<-subset(codes_, ID %in% c(2,10,12,13,14,15,16,17,18,20,29,38,47,56,65,74))
rat <- levels(changeDet1)[[1]]
rat[["Changes"]] <- codes_
levels(changeDet1) <- rat
levelplot(changeDet1, par.settings=PuOrTheme(), xlab="", ylab="")