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

'size' no longer affects linewidth in 'geom_sf()' #4883

Closed
trevorld opened this issue Jun 19, 2022 · 4 comments · Fixed by #4884
Closed

'size' no longer affects linewidth in 'geom_sf()' #4883

trevorld opened this issue Jun 19, 2022 · 4 comments · Fixed by #4884

Comments

@trevorld
Copy link

trevorld commented Jun 19, 2022

I'm observing that changing size in geom_sf() no longer affects linewidth:

library("ggplot2")
library("sf")
#> Linking to GEOS 3.9.1, GDAL 3.3.2, PROJ 7.2.1; sf_use_s2() is TRUE
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
indices <- which(nc$CNTY_ID >= 1820 & nc$CNTY_ID <= 1830)
nc <- nc[indices, ]

p <- ggplot(nc, aes(fill = NAME)) +
  theme_bw(15)

p + geom_sf(size = 3)

Changing linewidth does affect linewidth:

p + geom_sf(linewidth = 3)

This breaking change isn't documented in the NEWS.md file and according to the discussion in #3672 it doesn't seem like such a "breaking change" was intended until after proper deprecation?:

@yutannihilation wrote:

Just curious, will this eventually change the behavior of size on Geoms that actually have both size and linewidth? I know there's no breaking change here, but #4872 made me think this might need some consideration to avoid ambiguity.

For example, in the case of geom_pointrange(), it's not clear what to do when we want to increase only the size of the points. Does specifying only size achieve this? Or, will this increase both the size of the points and that of the lines? I feel the former behavior is right, but it would be a breaking change.

and @thomasp85 replied:

At this point the ambiguous geoms will not differentiate but I think we would do that down the line after proper deprecation

@yutannihilation
Copy link
Member

Thank you for reporting! It seems this was simply our oversight.

@yutannihilation
Copy link
Member

@trevorld
Just for sharing, we changed our mind to accept this breaking change as we believe this is the correct behavior for Geoms that have both size and linewidth.

#4964

@trevorld
Copy link
Author

trevorld commented Aug 25, 2022

@yutannihilation Thanks for the heads up. I'll update geom_sf_pattern() and geom_boxplot_pattern() accordingly in {ggpattern} to match this upstream change.

@yutannihilation
Copy link
Member

Thanks. The FAQ section of this blog post should also help.

https://www.tidyverse.org/blog/2022/08/ggplot2-3-4-0-size-to-linewidth/#faq

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

Successfully merging a pull request may close this issue.

2 participants