Geographic Information Systems Asked on March 19, 2021
I would like to use tmap
R package to plot a RasterStack object. The problem is that the coordinates are not real coordinates, but rather climate variables, so I can not specify a valid reference coordinate system. I can plot this object in ggplot
and lattice
, but I would really like to do it in tmap
.
> temp_object
class : RasterStack
dimensions : 400, 550, 220000, 1 (nrow, ncol, ncell, nlayers)
resolution : 0.1, 10 (x, y)
extent : -20, 35, 0, 4000 (xmin, xmax, ymin, ymax)
crs : NA
names : X1
min values : 0.001695915
max values : 0.1038332
> tm_shape(temp_object, bbox=tmaptools::bb(matrix(c(-20,0,35,4000),2,2))) + tm_raster()
Error: The projection of the shape object temp_shp is not known, while it seems to be projected.
If I try to specify a projection, I do get my plot, but the aspect of x and y is not OK and I did not find any argument in tmap
R package, which could give me a desired aspect ratio.
crs(temp_object) <- "+proj=lcc +lat_1=48 +lat_2=33 +lon_0=-100 +ellps=WGS84"
tm_shape(temp_object, bbox=tmaptools::bb(matrix(c(-20,0,35,4000),2,2))) +
tm_raster(legend.show = FALSE) + tm_grid()
Is there any argument in tmap
, which would enable me to plot this raster with random aspect ratio? An example of such argument in ggR
R package is argument coord_equal = FALSE
.
library(RStoolbox)
ggR(temp_object, coord_equal = F, geom_raster = 1)
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP