diff --git a/R/bayesplot-helpers.R b/R/bayesplot-helpers.R
index d3d86ec3..52f47a11 100644
--- a/R/bayesplot-helpers.R
+++ b/R/bayesplot-helpers.R
@@ -21,7 +21,7 @@
#' [ggplot2::element_line()].
#'
#' For `overlay_function`, `...` is passed to
-#' [ggplot2::stat_function()].
+#' [ggplot2::geom_function()].
#'
#' @return
#' A **ggplot2** layer or [ggplot2::theme()] object that can be
@@ -91,7 +91,7 @@
#' }
#'
#' \subsection{Superimpose a function on an existing plot}{
-#' * `overlay_function()` is a simple wrapper for [ggplot2::stat_function()] but
+#' * `overlay_function()` is a simple wrapper for [ggplot2::geom_function()] but
#' with the `inherit.aes` argument fixed to `FALSE`. Fixing `inherit.aes=FALSE`
#' will avoid potential errors due to the [ggplot2::aes()]thetic mapping used by
#' certain **bayesplot** plotting functions.
@@ -467,7 +467,7 @@ grid_lines_y <- function(color = "gray50", size = 0.2) {
#' @rdname bayesplot-helpers
#' @export
overlay_function <- function(...) {
- stat_function(..., inherit.aes = FALSE)
+ geom_function(..., inherit.aes = FALSE)
}
diff --git a/R/mcmc-traces.R b/R/mcmc-traces.R
index cad857ae..9df18f6e 100644
--- a/R/mcmc-traces.R
+++ b/R/mcmc-traces.R
@@ -719,7 +719,7 @@ mcmc_trace_data <- function(x,
color = guide_legend(order = 1),
linetype = guide_legend(
order = 2, title = NULL, keywidth = rel(1/2),
- override.aes = list(size = rel(1/2)))
+ override.aes = list(linewidth = rel(1/2)))
)
}
}
diff --git a/man/bayesplot-helpers.Rd b/man/bayesplot-helpers.Rd
index 897bce92..3e378a7b 100644
--- a/man/bayesplot-helpers.Rd
+++ b/man/bayesplot-helpers.Rd
@@ -90,7 +90,7 @@ For \code{xaxis_ticks} and \code{yaxis_ticks}, \code{...} is passed to
\code{\link[ggplot2:element]{ggplot2::element_line()}}.
For \code{overlay_function}, \code{...} is passed to
-\code{\link[ggplot2:geom_function]{ggplot2::stat_function()}}.}
+\code{\link[ggplot2:geom_function]{ggplot2::geom_function()}}.}
\item{na.rm}{A logical scalar passed to the appropriate geom (e.g.
\code{\link[ggplot2:geom_abline]{ggplot2::geom_vline()}}). The default is \code{TRUE}.}
@@ -189,7 +189,7 @@ an existing plot (ggplot object) to add grid lines to the plot background.
\subsection{Superimpose a function on an existing plot}{
\itemize{
-\item \code{overlay_function()} is a simple wrapper for \code{\link[ggplot2:geom_function]{ggplot2::stat_function()}} but
+\item \code{overlay_function()} is a simple wrapper for \code{\link[ggplot2:geom_function]{ggplot2::geom_function()}} but
with the \code{inherit.aes} argument fixed to \code{FALSE}. Fixing \code{inherit.aes=FALSE}
will avoid potential errors due to the \code{\link[ggplot2:aes]{ggplot2::aes()}}thetic mapping used by
certain \strong{bayesplot} plotting functions.
diff --git a/tests/testthat/_snaps/mcmc-traces/mcmc-trace-divergences-custom.svg b/tests/testthat/_snaps/mcmc-traces/mcmc-trace-divergences-custom.svg
index b856f48d..b7b9d0b5 100644
--- a/tests/testthat/_snaps/mcmc-traces/mcmc-trace-divergences-custom.svg
+++ b/tests/testthat/_snaps/mcmc-traces/mcmc-trace-divergences-custom.svg
@@ -104,7 +104,7 @@
2
3
4
-
+
Divergence
mcmc_trace divergences (custom)
diff --git a/tests/testthat/_snaps/mcmc-traces/mcmc-trace-divergences-default.svg b/tests/testthat/_snaps/mcmc-traces/mcmc-trace-divergences-default.svg
index 2063b26e..0bd292ca 100644
--- a/tests/testthat/_snaps/mcmc-traces/mcmc-trace-divergences-default.svg
+++ b/tests/testthat/_snaps/mcmc-traces/mcmc-trace-divergences-default.svg
@@ -104,7 +104,7 @@
2
3
4
-
+
Divergence
mcmc_trace divergences (default)
diff --git a/tests/testthat/test-convenience-functions.R b/tests/testthat/test-convenience-functions.R
index 7b197f27..83ec7e91 100644
--- a/tests/testthat/test-convenience-functions.R
+++ b/tests/testthat/test-convenience-functions.R
@@ -180,9 +180,8 @@ test_that("yaxis_ticks returns correct theme object", {
# overlay functions -------------------------------------------------------
test_that("overlay_function returns the correct object", {
- expect_error(overlay_function(), 'argument "fun" is missing')
a <- overlay_function(fun = "dnorm")
- b <- stat_function(fun = "dnorm", inherit.aes = FALSE)
+ b <- geom_function(fun = "dnorm", inherit.aes = FALSE)
a$constructor <- b$constructor <- NULL
expect_equal(a, b, ignore_function_env = TRUE)
})