Skip to content
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
6 changes: 3 additions & 3 deletions R/bayesplot-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
}


Expand Down
2 changes: 1 addition & 1 deletion R/mcmc-traces.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions man/bayesplot-helpers.Rd

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

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions tests/testthat/test-convenience-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down
Loading