Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tm_lines results in graphical artifacts #835

Open
James-G-Hill opened this issue Feb 12, 2024 · 3 comments
Open

tm_lines results in graphical artifacts #835

James-G-Hill opened this issue Feb 12, 2024 · 3 comments

Comments

@James-G-Hill
Copy link

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?

Screenshot 2024-02-12 014946

@mtennekes
Copy link
Member

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")

@James-G-Hill
Copy link
Author

Thanks @mtennekes I will try this to see if there is an improvement.

@James-G-Hill
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants