tmap_save中的错误:找不到对象"tm"



当我尝试将我的绘图另存为 HTML 文件时,出现此错误:

Error in `+.tmap`(e1 = tm, e2 = do.call("tm_layout", args)) : object 'tm' not found

这是我的代码:

tm_shape(countries_spdf) +
tm_grid(n.x = 11, n.y = 11) +
tm_fill(col = "population", style = "quantile")  +
tm_borders(col = "burlywood4")
# Save a static version "population.png" [success]
tmap_save(filename = "population.png")
# Save an interactive version "population.html" [fail]
tmap_save(filename = "population.html")

我该怎么办?

尝试两件事:

  1. 在不调用tmap_save(文件名 = "population.png"(的情况下运行所有内容。

  2. 将映射分配给对象。

    Map <- tm_shape(countries_spdf) +
    tm_grid(n.x = 11, n.y = 11) +
    tm_fill(col = "population", style = "quantile")  +
    tm_borders(col = "burlywood4")
    tmap_save(tm = Map, filename = "population.html")
    

相关内容

  • 没有找到相关文章

最新更新