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
Linewidth not removing borders in geom_sf() #5333
Comments
Thanks for the report! I can reproduce this, but only when using the windows device. Have you tried other devices, like {ragg} or the Cairo PNG device? |
This is not a bug as such. The R documentation for graphic devices says that graphic devices should be implemented in such a way that a line width of 0 should draw the thinnest possible line. Does that make sense? Maybe not, but it is the expected behaviour. It is much better to rely on setting the color to NA to turn off rendering |
Accidentally closed, see previous comment (sorry). |
Following Thomas' suggestion, I switched to col = NA and also tried using {ragg}. Reprex still contains lines around polygons.
|
Aside from some anti-aliasing in the second plot. which probably is difficult to get around, I'm having some trouble seeing what borders remain in the first plot. |
@teunbrand the first plot works as I'd like it to. I agree it could be anti-aliasing in the second plot, however, I have made plots in the past (prior to the size -> linewidth change) that did not have this issue. The major issue I have with the second plot is when I try to plot polygons in black (especially a complex polygon), the outlines show up. The only workaround I've found is to set the colour of each polygon to the same as the fill, and reduce linewidth as much as possible. But it seems like there should be an easier way to remove the borders. |
Thanks that clarifies things: I do see border artefacts in some devices when setting the fill to black. Sadly though, I don't think there is an opportunity for ggplot2 to change anything, as ggplot2 mostly passes shapes to grid, and grid passes shapes to the graphics device. If there is an issue with the graphics device, it is at least one step removed from ggplot2's control. As a workaround, I'd suggest to use |
…inewidth = 0 on Windows. Closing #13. Version bumped to make this change visible to Bioconductor users. I thought I was done with bugs for now when I version bumped earlier today, but I was wrong.
I found a problem with ggplot2 when trying to remove the borders of a polygon using geom_sf() after the change from the size argument to the linewidth argument. I am on ggplot 3.4.2
I expected setting linewidth = 0 to remove the borders, as it previously did when setting size = 0.
Here is the code to reproduce the bug:
The text was updated successfully, but these errors were encountered: