Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 如何安排此图例的位置_R_Tmap - Fatal编程技术网

R 如何安排此图例的位置

R 如何安排此图例的位置,r,tmap,R,Tmap,如下图所示,如何将图例放置到网格中的最后一个单元格 我使用的代码是 psp1 <- tm_shape(province) + tm_borders(col = 'black') + tm_shape(county) + tm_polygons(col = 'estimate', title = 'Changes in %', style = 'fixed', palette = brewer.pal(n = 6, name = 'Spectral'),

如下图所示,如何将图例放置到网格中的最后一个单元格

我使用的代码是

psp1 <-   tm_shape(province) + 
  tm_borders(col = 'black') + 
  tm_shape(county) + 
  tm_polygons(col = 'estimate', title = 'Changes in %', style = 'fixed', palette = brewer.pal(n = 6, name = 'Spectral'), 
              breaks = c(-15, -10, -5, 0, 5, 10, 15), legend.hist = F) + 
  tm_facets('warming', ncol = 2) + 
  tm_shape(province) + 
  tm_borders(col = 'black') + 
  tm_compass(north = 0, type = 'arrow', show.labels =0, position = c('right','top')) + 
  tm_layout(legend.format = list(fun = function(x) formatC(x, digits = 1, format = "f")),
            fontface = 'bold',
            legend.text.size = 1.3,
            legend.width = 0.2,
            legend.title.size = 1.5,
            panel.label.size = 1.5,
            panel.label.fontface = 'bold')

psp1