Skip to content

Commit bb50861

Browse files
committed
Merge branch 'master' into issue-258
2 parents 13c8253 + 60edc5a commit bb50861

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+8656
-6664
lines changed

DESCRIPTION

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: bayesplot
22
Type: Package
33
Title: Plotting for Bayesian Models
4-
Version: 1.8.0.9000
5-
Date: 2021-01-07
4+
Version: 1.8.1
5+
Date: 2021-06-13
66
Authors@R: c(person("Jonah", "Gabry", role = c("aut", "cre"), email = "[email protected]"),
77
person("Tristan", "Mahr", role = "aut"),
88
person("Paul-Christian", "Bürkner", role = "ctb"),
@@ -21,7 +21,6 @@ Description: Plotting functions for posterior analysis, MCMC diagnostics,
2121
developers working on a variety of R packages for Bayesian modeling,
2222
particularly (but not exclusively) packages interfacing with 'Stan'.
2323
License: GPL (>= 3)
24-
LazyData: TRUE
2524
URL: https://mc-stan.org/bayesplot/
2625
BugReports: https://github.com/stan-dev/bayesplot/issues/
2726
SystemRequirements: pandoc (>= 1.12.3), pandoc-citeproc

NEWS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<!-- See http://style.tidyverse.org/news.html for advice on writing news -->
22

3-
# bayesplot 1.8.0.9000
3+
# bayesplot 1.8.1
44

5-
Items for next release go here
5+
* Fix R cmd check error on linux for CRAN
66

77
* `mcmc_dens()` and `mcmc_dens_overlay()` gain arguments for controlling the
88
the density calculation. (#258)

R/mcmc-recover.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ mcmc_recover_hist <-
315315

316316
vline_data <- data.frame(Parameter = colnames(x), True = true)
317317
hist_data <- melt_mcmc(x)[, -1]
318+
vline_data$Parameter <- factor(vline_data$Parameter, levels = levels(hist_data$Parameter))
318319

319320
facet_args[["facets"]] <- "Parameter"
320321
facet_args[["scales"]] <- facet_args[["scales"]] %||% "free"

R/ppc-intervals.R

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,17 @@ ppc_intervals_grouped <- function(y,
173173

174174
#' @rdname PPC-intervals
175175
#' @export
176+
#' @param y_draw For ribbon plots only, a string specifying how to draw `y`. Can
177+
#' be `"line"` (the default), `"points"`, or `"both"`.
176178
ppc_ribbon <- function(y,
177179
yrep,
178180
x = NULL,
179181
...,
180182
prob = 0.5,
181183
prob_outer = 0.9,
182184
alpha = 0.33,
183-
size = 0.25) {
185+
size = 0.25,
186+
y_draw = c("line", "points", "both")) {
184187
check_ignored_arguments(...)
185188

186189
data <- ppc_intervals_data(
@@ -197,7 +200,8 @@ ppc_ribbon <- function(y,
197200
size = size,
198201
grouped = FALSE,
199202
style = "ribbon",
200-
x_lab = label_x(x)
203+
x_lab = label_x(x),
204+
y_draw = y_draw
201205
)
202206
}
203207

@@ -213,7 +217,8 @@ ppc_ribbon_grouped <- function(y,
213217
prob = 0.5,
214218
prob_outer = 0.9,
215219
alpha = 0.33,
216-
size = 0.25) {
220+
size = 0.25,
221+
y_draw = c("line", "points", "both")) {
217222
check_ignored_arguments(...)
218223

219224
data <- ppc_intervals_data(
@@ -234,7 +239,8 @@ ppc_ribbon_grouped <- function(y,
234239
size = size,
235240
grouped = TRUE,
236241
style = "ribbon",
237-
x_lab = label_x(x)
242+
x_lab = label_x(x),
243+
y_draw = y_draw
238244
)
239245
}
240246

@@ -319,9 +325,11 @@ label_x <- function(x) {
319325
size = 1,
320326
grouped = FALSE,
321327
style = c("intervals", "ribbon"),
322-
x_lab = NULL) {
328+
x_lab = NULL,
329+
y_draw = c("line", "points", "both")) {
323330

324331
style <- match.arg(style)
332+
y_draw <- match.arg(y_draw)
325333

326334
graph <- ggplot(
327335
data = data,
@@ -349,11 +357,22 @@ label_x <- function(x) {
349357
aes_(color = "yrep"),
350358
size = size/2
351359
) +
352-
geom_blank(aes_(fill = "y")) +
353-
geom_line(
360+
geom_blank(aes_(fill = "y"))
361+
362+
if (y_draw == "line" || y_draw == "both") {
363+
graph <- graph + geom_line(
354364
aes_(y = ~ y_obs, color = "y"),
355365
size = 0.5
356366
)
367+
}
368+
369+
if (y_draw == "points" || y_draw == "both") {
370+
graph <- graph + geom_point(
371+
mapping = aes_(y = ~ y_obs, color = "y", fill = "y"),
372+
shape = 21,
373+
size = 1.5
374+
)
375+
}
357376
} else {
358377
graph <- graph +
359378
geom_pointrange(

man/PPC-intervals.Rd

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

tests/figs/deps.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
- vdiffr-svg-engine: 1.0
2-
- vdiffr: 0.3.2.2
3-
- freetypeharfbuzz: 0.2.5
2+
- vdiffr: 0.3.3
3+
- freetypeharfbuzz: 0.2.6

tests/figs/mcmc-intervals/mcmc-areas-default.svg

Lines changed: 10 additions & 0 deletions
Loading

tests/figs/mcmc-intervals/mcmc-areas-equal-height.svg

Lines changed: 10 additions & 0 deletions
Loading

tests/figs/mcmc-intervals/mcmc-areas-inner.svg

Lines changed: 10 additions & 0 deletions
Loading

tests/figs/mcmc-intervals/mcmc-areas-means.svg

Lines changed: 10 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)