Skip to content

Commit 9cee9ae

Browse files
committed
Merge branch 'master' into new-pkgdown-setup
2 parents 92cf51f + fda764c commit 9cee9ae

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

R/helpers-ppc.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ validate_predictions <- function(predictions, n_obs = NULL) {
101101
#' Validate PIT
102102
#'
103103
#' Checks that `pit` is numeric, doesn't have any NAs, and is either a vector,
104-
#' or a 1-D array with values in [0,1].
104+
#' or a 1-D array with values in `[0,1]`.
105105
#'
106106
#' @param pit The 'pit' object from the user.
107107
#' @return Either throws an error or returns a numeric vector.
@@ -521,8 +521,8 @@ get_interpolation_values <- function(N, K, L, prob) {
521521
#' within the bounds until z1 and takes the value in x1 at z1.
522522
#' @param x1 Vector of scaled ECDF values at the left end of the interval, z1.
523523
#' @param x2 Vector of scaled ECDF values at the right end of the interval, z2.
524-
#' @param z1 Left evaluation point in [0,1]
525-
#' @param z2 Right evaluation point in [0,1] with z2 > z1.
524+
#' @param z1 Left evaluation point in `[0,1]`
525+
#' @param z2 Right evaluation point in `[0,1]` with z2 > z1.
526526
#' @param N Total number of values in the sample.
527527
#' @return A vector containing the probability to transitioning from the values
528528
#' in x1 to each of the values in x2 weighted by the probabilities in p_int.

R/zzz.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010
"\nUse update.packages('ggplot2') to update.")
1111
}
1212
}
13+
.onLoad <- function(libname, pkgname) {
14+
bayesplot_theme_set()
15+
}

tests/testthat/test-aesthetics.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,18 @@ test_that("ggplot2::theme_set overrides bayesplot theme", {
210210
expect_identical(bayesplot_theme_get(), minimal)
211211
})
212212

213+
test_that(".onLoad keeps ggplot theme and resets bayesplot theme", {
214+
old <- ggplot2::theme_set(ggplot2::theme_minimal())
215+
before <- ggplot2::theme_get()
216+
bayesplot:::.onLoad()
217+
218+
expect_identical(bayesplot_theme_get(), default)
219+
expect_equal(.bayesplot_theme_env$current, default)
220+
expect_equal(ggplot2::theme_get(), before)
221+
expect_equal(.bayesplot_theme_env$gg_current, before)
222+
ggplot2::theme_set(old)
223+
})
224+
213225
bayesplot_theme_set(bayesplot::theme_default())
214226
color_scheme_set()
215227

0 commit comments

Comments
 (0)