0

I'm having an issue with finding answers for a fairly simple question. I just need to move the axis titles (xlab and ylab) away from the axes. I haven't uploaded reproducible data since the files are large shapefiles, but I can upload it if needed (I figure it's a fairly straightforward answer). I have attached the code I've used so far as well as the map I'm struggling with:

LandUseMap <- tm_shape(LandUseshape, ylim = c(50.45, 50.68), xlim=c(-105, 
-104.7), projection = "longlat") + 
tm_fill("COVTYPE", title = "Land Cover Type",style="fixed",breaks=c(20,30,34,50,110,121,122,220,230),
      labels=c("Water","Non-Vegetated Land","Developed","Shrubland","Grassland","Annual Cropland","Perennial Crops/Pasture","Broadleaf","No Data"),
      palette=manualpal)  +
tm_borders("grey") +
tm_legend(outside = TRUE, text.size = .65) +
tm_layout(frame = FALSE,asp =NA, outer.margins = c(0.05,0.1,0,0), inner.margins = c(0.05,0.05,0.01,0.05))+
tm_grid(y=c(50.45, 50.50, 50.55, 50.60, 50.65), x=c(-105.0,-104.9,-104.8,-104.7),labels.inside.frame = FALSE, col = "#00ff0000",
      labels.size =0.8)+
tm_xlab("Longitude", size = 1)+
tm_ylab("Latitude", size = 1)+
tm_scale_bar(size = 1, position = c(0,0.8)) + 
tm_compass(size=2.5,north = 0,position = c(0,0.9))
LandUseMap

Here's the map:enter image description here

TheSciGuy
  • 1,154
  • 11
  • 22
  • have you tried `labels.margin.x` and `labels.margin.y`? – MLavoie Jul 25 '18 at 20:56
  • Unfortunately I have. It just moves the axis labels, not the titles ("Longitude" or "Latitude") – TheSciGuy Jul 25 '18 at 21:16
  • See `tm_xlab(...,space=...)`. From the `?tm_xlab`, space controls the "space between labels and the map in numbers of line heights. By default, it is 0, unless grid labels are plotted outside the frame". – gregor-fausto Aug 23 '21 at 17:03

0 Answers0