Skip to content

Commit

Permalink
add args to set axis titles
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Mar 27, 2024
1 parent 80daa3c commit e843965
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 12 deletions.
6 changes: 4 additions & 2 deletions R/plot.binned_residuals.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
plot.see_binned_residuals <- function(x,
size_line = 0.7,
size_point = 2.2,
size_axis_title = base_size * 0.8,
base_size = 10,
colors = social_colors(c("blue", "red", "green")),
show_smooth = FALSE,
style = theme_lucid,
base_size = 10,
...) {
x$se.lo <- -x$se
if (length(unique(x$group)) > 1L) {
Expand Down Expand Up @@ -108,7 +109,8 @@ plot.see_binned_residuals <- function(x,
p <- p + theme_style(
base_size = base_size,
plot.title.space = 3,
axis.title.space = 5
axis.title.space = 5,
axis.title = ggplot2::element_text(size = size_axis_title)
)
}

Expand Down
12 changes: 11 additions & 1 deletion R/plot.check_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ plot.see_check_model <- function(x,
show_labels <- attr(x, "show_labels") %||% TRUE
size_text <- attr(x, "text_size")
base_size <- attr(x, "base_size")
size_axis_title <- attr(x, "axis_title_size")
alpha_level <- attr(x, "alpha")
dot_alpha_level <- attr(x, "dot_alpha")
show_dots <- attr(x, "show_dots")
Expand Down Expand Up @@ -79,6 +80,10 @@ plot.see_check_model <- function(x,
base_size <- 10
}

if (is.null(size_axis_title)) {
size_axis_title <- base_size * 0.8
}

if (is.null(check)) {
check <- "all"
}
Expand All @@ -94,6 +99,7 @@ plot.see_check_model <- function(x,
size_line = size_line,
size_point = size_point,
base_size = base_size,
size_axis_title = size_axis_title,
type = type,
check_model = TRUE,
adjust_legend = TRUE,
Expand All @@ -109,6 +115,7 @@ plot.see_check_model <- function(x,
alpha_level,
theme_style = style,
base_size = base_size,
size_axis_title = size_axis_title,
colors = colors,
dot_alpha_level = dot_alpha_level,
show_dots = show_dots
Expand All @@ -121,6 +128,7 @@ plot.see_check_model <- function(x,
x$BINNED_RESID,
style = style,
base_size = base_size,
size_axis_title = size_axis_title,
colors = colors[c(2, 3, 1)],
adjust_legend = TRUE,
check_model = TRUE,
Expand Down Expand Up @@ -254,6 +262,7 @@ plot.see_check_model <- function(x,
.plot_diag_linearity <- function(x,
size_point,
size_line,
size_axis_title = 8,
alpha_level = 0.2,
theme_style = theme_lucid,
base_size = 10,
Expand Down Expand Up @@ -290,6 +299,7 @@ plot.see_check_model <- function(x,
theme_style(
base_size = base_size,
plot.title.space = 3,
axis.title.space = 5
axis.title.space = 5,
axis.title = ggplot2::element_text(size = size_axis_title)
)
}
1 change: 1 addition & 0 deletions R/plot.check_normality.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#' `"ks"` or `"ts"` for simultaneous testing. See `qqplotr::stat_qq_band()`
#' for details.
#' @param base_size Base font size for plots.
#' @param size_axis_title Numeric value specifying size of axis titles.
#' @inheritParams data_plot
#' @inheritParams plot.see_bayesfactor_parameters
#'
Expand Down
25 changes: 19 additions & 6 deletions R/plot.check_predictions.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ print.see_performance_pp_check <- function(x,
size_point = 2,
line_alpha = 0.15,
size_bar = 0.7,
size_axis_title = base_size * 0.8,
style = theme_lucid,
base_size = 10,
colors = unname(social_colors(c("green", "blue"))),
type = c("density", "discrete_dots", "discrete_interval", "discrete_both"),
x_limits = NULL,
Expand All @@ -103,6 +105,7 @@ print.see_performance_pp_check <- function(x,
line_alpha,
theme_style = style,
colors = colors,
base_size = base_size,
type = type,
x_limits = x_limits,
...
Expand All @@ -124,8 +127,9 @@ print.see_performance_pp_check <- function(x,
plot.see_performance_pp_check <- function(x,
size_line = 0.5,
size_point = 2,
line_alpha = 0.15,
size_bar = 0.7,
size_axis_title = base_size * 0.8,
line_alpha = 0.15,
style = theme_lucid,
base_size = 10,
colors = unname(social_colors(c("green", "blue"))),
Expand All @@ -148,11 +152,12 @@ plot.see_performance_pp_check <- function(x,

p1 <- .plot_pp_check(
x,
size_line,
size_point,
line_alpha,
size_line = size_line,
size_point = size_point,
line_alpha = line_alpha,
theme_style = style,
base_size = base_size,
size_axis_title = size_axis_title,
colors = colors,
type = type,
x_limits = x_limits,
Expand All @@ -175,6 +180,7 @@ plot.see_performance_pp_check <- function(x,
line_alpha,
theme_style,
base_size = 10,
size_axis_title = 8,
colors,
type = "density",
x_limits = NULL,
Expand Down Expand Up @@ -209,7 +215,8 @@ plot.see_performance_pp_check <- function(x,
out <- out + theme_style(
base_size = base_size,
plot.title.space = 3,
axis.title.space = 5
axis.title.space = 5,
axis.title = ggplot2::element_text(size = size_axis_title)
)
}

Expand All @@ -229,7 +236,13 @@ plot.see_performance_pp_check <- function(x,
}


.plot_check_predictions_density <- function(x, colors, info, size_line, line_alpha, bandwidth, ...) {
.plot_check_predictions_density <- function(x,
colors,
info,
size_line,
line_alpha,
bandwidth,
...) {
ggplot2::ggplot(x) +
ggplot2::stat_density(
mapping = ggplot2::aes(
Expand Down
2 changes: 2 additions & 0 deletions man/plot.see_check_normality.Rd

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

11 changes: 8 additions & 3 deletions man/print.see_performance_pp_check.Rd

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

0 comments on commit e843965

Please sign in to comment.