I'm seeing some strange behavior when I plot a certain raster. This is a shaded relief raster I acquired from naturalearthdata.com.You can download it here.
I find that depending on what spatial scale I plot the raster at, it plots a different resolution, despite the resolution of the raster not being changed.
library(raster)
relief <- raster('GRAY_50M_SR_W.tif')
# let's use Mexico as an example:
library(maptools)
data(wrld_simpl)
mx <- wrld_simpl[which(wrld_simpl@data$NAME == 'Mexico'),]
# Here I create a cropped version of the raster
reliefMX <- crop(relief, mx)
To illustrate the problem, I plot Mexico to get the map extent, then I plot the full extent of the raster, and then the cropped raster on top.
You can see that the rasters show very different resolutions, but they really have identical resolutions.
plot(mx)
plot(relief, col = grey(0:100/100), legend = FALSE, axes = F, box = F, add=T)
plot(reliefMX, col = grey(0:100/100), legend = FALSE, axes = F, box = F, add=T)
> res(relief)
[1] 0.03333333 0.03333333
> res(reliefMX)
[1] 0.03333333 0.03333333
Any ideas? How can I get these rasters to display properly?
> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.4
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] maptools_0.9-2 raster_2.5-8 sp_1.2-4
loaded via a namespace (and not attached):
[1] compiler_3.4.0 rgdal_1.2-7 tools_3.4.0 foreign_0.8-68 Rcpp_0.12.10
[6] grid_3.4.0 lattice_0.20-35



