Skip to content

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

@trevorld

Description

@trevorld

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions