Skip to content

Could geom_abline and geom_qq_line always stop at the limits, regardless of other settings?  #6081

Closed
@davidhodge931

Description

@davidhodge931

Could geom_abline and geom_qq_line always stop at the limits, regardless of other settings?

So kind of act in the same way that geom_hline/geom_vline behave.

library(tidyverse)
library(palmerpenguins)

penguins |> 
  ggplot() +
  coord_cartesian(clip = "off") +
  scale_x_continuous(limits = c(-2, 2), oob = scales::oob_keep, expand = c(0, 0)) +
  scale_y_continuous(limits = c(2000, 6500), oob = scales::oob_keep, expand = c(0, 0)) +
  geom_qq(aes(sample = body_mass_g)) +
  geom_vline(xintercept = 1.5) + #good 
  geom_hline(yintercept = 3000) + #good
  geom_abline(intercept = 3000, slope = 250, colour = "blue") +
  geom_abline(intercept = 3000, slope = 1000, colour = "green") +
  geom_qq_line(aes(sample = body_mass_g), colour = "red") +
  theme(plot.margin = margin(r = 100))
#> Warning: Removed 2 rows containing non-finite outside the scale range
#> (`stat_qq()`).
#> Warning: Removed 2 rows containing non-finite outside the scale range
#> (`stat_qq_line()`).

Created on 2024-09-06 with reprex v2.1.1

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