Skip to content

Commit 0b67516

Browse files
authored
Clip qq line (#6220)
* `geom/stat_qq_line()` use `stat = "abline"` * document new computed variables * add news bullet
1 parent e327a5e commit 0b67516

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# ggplot2 (development version)
22

3+
* New default `geom_qq_line(geom = "abline")` for better clipping in the
4+
vertical direction. In addition, `slope` and `intercept` are new computed
5+
variables in `stat_qq_line()` (@teunbrand, #6087).
36
* Position adjustments can now have auxiliary aesthetics (@teunbrand).
47
* `position_nudge()` gains `nudge_x` and `nudge_y` aesthetics (#3026, #5445).
58
* `position_dodge()` gains `order` aesthetic (#3022, #3345)

R/stat-qq-line.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#' the data
77
geom_qq_line <- function(mapping = NULL,
88
data = NULL,
9-
geom = "path",
9+
geom = "abline",
1010
position = "identity",
1111
...,
1212
distribution = stats::qnorm,
@@ -86,6 +86,9 @@ StatQqLine <- ggproto("StatQqLine", Stat,
8686
x <- range(theoretical)
8787
}
8888

89-
data_frame0(x = x, y = slope * x + intercept)
89+
data_frame0(
90+
x = x, y = slope * x + intercept,
91+
slope = slope, intercept = intercept
92+
)
9093
}
9194
)

R/stat-qq.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
#' x = "x-coordinates of the endpoints of the line segment connecting the
2323
#' points at the chosen quantiles of the theoretical and the sample
2424
#' distributions.",
25-
#' y = "y-coordinates of the endpoints."
25+
#' y = "y-coordinates of the endpoints.",
26+
#' slope = "Amount of change in `y` across 1 unit of `x`.",
27+
#' intercept = "Value of `y` at `x == 0`."
2628
#' )
2729
#'
2830
#' @export

man/geom_qq.Rd

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)