Skip to content

Commit 6bc4fbe

Browse files
authored
merge pr #526: allow fill = NULL in shade_*() functions
2 parents 2c5e800 + 71454e6 commit 6bc4fbe

File tree

7 files changed

+5
-5
lines changed

7 files changed

+5
-5
lines changed

NEWS.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* Addresses ggplot2 warnings when shading p-values for test statistics
77
that are outside of the range of the generated distribution (#528).
88

9+
* Fixed bug in `shade_p_value()` and `shade_confidence_interval()` where `fill = NULL` was ignored when it was documented as preventing any shading (#525).
10+
911
# infer v1.0.6
1012

1113
* Updated infrastructure for errors, warnings, and messages (#513). Most of these changes will not be visible to users, though:

R/shade_confidence_interval.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ shade_confidence_interval <- function(endpoints, color = "mediumaquamarine",
133133
fn = "shade_confidence_interval",
134134
endpoints = if (is.null(endpoints)) {NA} else {endpoints},
135135
color = color,
136-
fill = fill,
136+
fill = list(fill),
137137
dots = list(...)
138138
)
139139
}

R/shade_p_value.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ shade_p_value <- function(obs_stat, direction,
123123
obs_stat = if (is.null(obs_stat)) {NA} else {obs_stat},
124124
direction = if (is.null(direction)) {NA} else {direction},
125125
color = color,
126-
fill = fill,
126+
fill = list(fill),
127127
dots = list(...)
128128
)
129129
}

R/visualize.R

+1
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,7 @@ ggplot_add.infer_layer <- function(object, plot, object_name) {
689689
shade_fn <- attr(object, "fn")
690690
shade_args <- attributes(object)[!names(attributes(object)) %in%
691691
c("class", "fn")]
692+
shade_args["fill"] <- shade_args[["fill"]]
692693

693694
# if a patchwork object, use a custom `infer_layer` `+.gg` method.
694695
# otherwise, convert the `infer_layer` back to a list and call `+` again.

tests/testthat/_snaps/shade_confidence_interval/ci-both-nofill.svg

-1
Loading

tests/testthat/_snaps/shade_confidence_interval/ci-sim-nofill.svg

-1
Loading

tests/testthat/_snaps/shade_confidence_interval/ci-theor-nofill.svg

-1
Loading

0 commit comments

Comments
 (0)