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

suggested fix for geom_hpline() for newer versions of ggplot2 #3

Open
remomomo opened this issue Jan 11, 2024 · 1 comment
Open

suggested fix for geom_hpline() for newer versions of ggplot2 #3

remomomo opened this issue Jan 11, 2024 · 1 comment

Comments

@remomomo
Copy link

Hi, I've recently installed the latest version of R and ggplot2, and noticed that my plots have changed. I suspect it has something to do with the change in how the width of lines is handled by ggplot2 (https://www.tidyverse.org/blog/2022/11/ggplot2-3-4-0/).

Instead of size, newer versions of ggplot2 require the use of linewidth for specifying line thickness.

For geom_hpline(), this seems to have done the trick:

GeomHpline <- ggproto("GeomHpline", GeomSegment,
  required_aes = c("x", "y"),
  non_missing_aes = c("linewidth", "colour", "linetype", "width"), # "linewidth" instead of "size" !!!
  default_aes = aes(
    width = 0.5, colour = "black", linewidth = 2, linetype = 1, # linewidth instead of size
    alpha = NA
  ),

[...]

Not sure this repo is still being updated, but others might find this info useful as well...

@clauswilke
Copy link
Collaborator

I don't really maintain this repo any longer. But you're welcome to submit a PR with this fix and I'll merge it.

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