I converted a raster to an image and wanted to plot it. However, I then get the following error:
library(raster)
r
#class : RasterLayer
#dimensions : 23320, 37199, 867480680 (nrow, ncol, ncell)
#resolution : 0.02, 0.02 (x, y)
#extent : 341668.9, 342412.9, 5879602, 5880069 (xmin, xmax, ymin, ymax)
#crs : +proj=utm +zone=33 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0
#source : r_tmp_2022-07-21_113344_507_06340.grd
#names : layer
#values : 2.220446e-16, 0.2999999 (min, max)
x <- maptools::as.im.Rasterlayer(r)
x
#real-valued pixel image 23320 x 37199 pixel array (ny, nx)
#enclosing rectangle: [341670, 342410] x [5879600, 5880100] units
plot(x)
#Error in (function (x = seq(0, 1, length.out = nrow(z)), y = seq(0, 1, :
#‘useRaster = TRUE’ can only be used with a regular grid
I've already tried to find this error with help(plot) or something but there is nothing about it anywhere.