2

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.

Severin
  • 21
  • 2

1 Answers1

1

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")
www
  • 4,124
  • 1
  • 11
  • 22
  • Thanks a lot, Ryan. Your solution is a cool hack. But I have to apologize: obviously I didn't not formulate my question precise enough. I would like to make a choropleth map – so setting the border color to `black` will not work in my case. I updated my question. – Severin Sep 14 '17 at 07:18
  • @Severin - Okay, I've added an alternative solution to try. I've also provided an answer to that slightly different, but related, SO question you added a link for in your edit. You can try that answer also in order to check if it works with your system. – www Sep 14 '17 at 17:10