tmap: Unsightly white borders Mac/Rstudio

474 views Asked by At

When doing this:

library(tmap)
data("Europe")
tm_shape(Europe)+
tm_polygons(col="black",lwd = NA)

I'm getting unsightly white borders with tmap. Tried tm_fill and tm_polygons. And also border.col=NA or lwd=0.

This happens in RStudio as well when I'm exporting to PDF or PNG.

thin white lines

Getting crazy about this and really appreciate any help. Thanks!

R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin16.5.0 (64-bit)
Running under: macOS Sierra 10.12.5

Matrix products: default BLAS:/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
 LAPACK: /usr/local/Cellar/openblas/0.2.19_1/lib/libopenblasp-r0.2.19.dylib

locale:
[1] de_DE.UTF-8/de_DE.UTF-8/de_DE.UTF-8/C/de_DE.UTF-8/de_DE.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.4.0 tools_3.4.0   

UPDATE My goal is a choropleth map. So setting the border-color to one specific value will not work in my case. To make a guess, I can imagine, this is a similar problem - although the problem already occurs in rstudio itself.

1

There are 1 answers

2
www On

Try setting the border.col and the lwd at the same time, like this:

library(tmap)

data("Europe")
tm_shape(Europe)+
tm_polygons(col="black",border.col="black",lwd = 1)

Output:

enter image description here

Edit:

If you don't have the option of setting the border.col to a specific color, try this alternative:

#set border color to transparent
data("Europe")
tm_shape(Europe)+
tm_polygons(col="black",border.col="transparent")