Skip to content

Commit a8f5581

Browse files
authored
Merge pull request #5136 from teunbrand/missing_linewidth_scales
Manual and identity scales for `linewidth`
2 parents c9b85d6 + 516cd30 commit a8f5581

File tree

6 files changed

+25
-1
lines changed

6 files changed

+25
-1
lines changed

NAMESPACE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,8 @@ export(scale_linewidth_continuous)
582582
export(scale_linewidth_date)
583583
export(scale_linewidth_datetime)
584584
export(scale_linewidth_discrete)
585+
export(scale_linewidth_identity)
586+
export(scale_linewidth_manual)
585587
export(scale_linewidth_ordinal)
586588
export(scale_radius)
587589
export(scale_shape)

NEWS.md

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

3+
* Added `scale_linewidth_manual()` and `scale_linewidth_identity()` to support
4+
the `linewidth` aesthetic (@teunbrand, #5050).
35
* Automatic breaks in `scale_*_binned()` should no longer be out-of-bounds,
46
and automatic limits expand to include these (@teunbrand, #5095, #5100).
57
* Renamed computed aesthetic in `stat_ecdf()` to `ecdf`, to prevent incorrect

R/scale-identity.r

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,15 @@ scale_linetype_identity <- function(..., guide = "none") {
9595
sc
9696
}
9797

98+
#' @rdname scale_identity
99+
#' @export
100+
scale_linewidth_identity <- function(..., guide = "none") {
101+
sc <- continuous_scale("linewidth", "identity", identity_pal(), ...,
102+
guide = guide, super = ScaleContinuousIdentity)
103+
104+
sc
105+
}
106+
98107
#' @rdname scale_identity
99108
#' @export
100109
scale_alpha_identity <- function(..., guide = "none") {

R/scale-manual.r

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ scale_linetype_manual <- function(..., values, breaks = waiver(), na.value = "bl
110110
manual_scale("linetype", values, breaks, ..., na.value = na.value)
111111
}
112112

113+
#' @rdname scale_manual
114+
#' @export
115+
scale_linewidth_manual <- function(..., values, breaks = waiver(), na.value = NA) {
116+
manual_scale("linewidth", values, breaks, ..., na.value = na.value)
117+
}
118+
113119
#' @rdname scale_manual
114120
#' @export
115121
scale_alpha_manual <- function(..., values, breaks = waiver(), na.value = NA) {
@@ -122,7 +128,6 @@ scale_discrete_manual <- function(aesthetics, ..., values, breaks = waiver()) {
122128
manual_scale(aesthetics, values, breaks, ...)
123129
}
124130

125-
126131
manual_scale <- function(aesthetic, values = NULL, breaks = waiver(), ..., limits = NULL) {
127132
# check for missing `values` parameter, in lieu of providing
128133
# a default to all the different scale_*_manual() functions

man/scale_identity.Rd

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

man/scale_manual.Rd

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

0 commit comments

Comments
 (0)