tmap
tmap copied to clipboard
`tm_lines` results in graphical artifacts
I create a simple map with a states
layer and then a series of lines representing the Eastern coast of the US. I applied a palette to the lines along with a categorical variable. Unfortunately the lines appear to have artifacts, presumably where they maybe overlapping at the ends due to the line width option.
I wondered if this would be temporarily fixable if there was an option that could allow selection of the butt
or square
line end type?
In v4, you can change the lineend
and line join
. These are arguments of tm_lines
, passed on to gpar
(see details there).
E.g.
tm_shape(rivers)+
tm_lines(col = "scalerank", lwd = 5, lineend = "butt")
Thanks @mtennekes I will try this to see if there is an improvement.
I realised what was causing this problem; I guess it maybe not a bug at all. The lines I had were actually a collection of simple features multi-lines. When I simplified these with sf::_st_simplify
the problem mostly disappeared. It appears that the ends of the lines sometimes are little pixely but this was made far worse by the use of many smaller lines with the multi-line type.