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

Clip qq line #6220

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# ggplot2 (development version)

* New default `geom_qq_line(geom = "abline")` for better clipping in the
vertical direction. In addition, `slope` and `intercept` are new computed
variables in `stat_qq_line()` (@teunbrand, #6087).
* `guide_*()` can now accept two inside legend theme elements:
`legend.position.inside` and `legend.justification.inside`, allowing inside
legends to be placed at different positions. Only inside legends with the same
Expand Down
7 changes: 5 additions & 2 deletions R/stat-qq-line.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' the data
geom_qq_line <- function(mapping = NULL,
data = NULL,
geom = "path",
geom = "abline",
position = "identity",
...,
distribution = stats::qnorm,
Expand Down Expand Up @@ -86,6 +86,9 @@ StatQqLine <- ggproto("StatQqLine", Stat,
x <- range(theoretical)
}

data_frame0(x = x, y = slope * x + intercept)
data_frame0(
x = x, y = slope * x + intercept,
slope = slope, intercept = intercept
)
}
)
4 changes: 3 additions & 1 deletion R/stat-qq.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
#' x = "x-coordinates of the endpoints of the line segment connecting the
#' points at the chosen quantiles of the theoretical and the sample
#' distributions.",
#' y = "y-coordinates of the endpoints."
#' y = "y-coordinates of the endpoints.",
#' slope = "Amount of change in `y` across 1 unit of `x`.",
#' intercept = "Value of `y` at `x == 0`."
#' )
#'
#' @export
Expand Down
6 changes: 4 additions & 2 deletions man/geom_qq.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading