Skip to content

Commit

Permalink
Merge pull request #314 from heavywatal/linewidth
Browse files Browse the repository at this point in the history
Replace size argument with linewidth for geom_line and geom_ridgeline
  • Loading branch information
jgabry authored Jan 18, 2024
2 parents 74ada0d + 90f8e1a commit 07df2ef
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
10 changes: 5 additions & 5 deletions R/mcmc-intervals.R
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,9 @@ mcmc_areas <- function(x,
}

if (!is.null(border_size)) {
args_bottom$size <- border_size
args_outer$size <- border_size
args_inner$size <- border_size
args_bottom$linewidth <- border_size
args_outer$linewidth <- border_size
args_inner$linewidth <- border_size
}

if (color_by_rhat) {
Expand Down Expand Up @@ -504,7 +504,7 @@ mcmc_areas_ridges <- function(x,
stat = "identity"
)
if (!is.null(border_size)) {
args_outer$size <- border_size
args_outer$linewidth <- border_size
}

layer_outer <- do.call(ggridges::geom_density_ridges, args_outer)
Expand Down Expand Up @@ -545,7 +545,7 @@ mcmc_areas_ridges <- function(x,
stat = "identity")

if (!is.null(border_size)) {
args_inner$size <- border_size
args_inner$linewidth <- border_size
}

layer_list_inner[[par_num]] <- do.call(ggridges::geom_ridgeline, args_inner)
Expand Down
2 changes: 1 addition & 1 deletion R/mcmc-parcoord.R
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ mcmc_parcoord <-
graph <- graph +
geom_line(
data = div_draws,
size = np_style$size[["div"]],
linewidth = np_style$size[["div"]],
alpha = np_style$alpha[["div"]],
color = np_style$color[["div"]]
)
Expand Down
6 changes: 5 additions & 1 deletion R/mcmc-traces.R
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,11 @@ mcmc_trace_data <- function(x,
}

geom_args <- list()
geom_args$size <- size %||% ifelse(style == "line", 1/3, 1)
if (style == "line") {
geom_args$linewidth = size %||% 1 / 3
} else {
geom_args$size = size %||% 1
}
layer_draws <- do.call(paste0("geom_", style), geom_args)

coord_window <- if (!is.null(window)) {
Expand Down

0 comments on commit 07df2ef

Please sign in to comment.