Skip to content

Commit f8baf90

Browse files
Harmonize API (#373)
1 parent 8286345 commit f8baf90

Some content is hidden

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

55 files changed

+346
-343
lines changed

R/plot.bayesfactor_parameters.R

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#' The `plot()` method for the `bayestestR::bayesfactor_parameters()` function.
44
#'
55
#' @param size_point Numeric specifying size of point-geoms.
6-
#' @param rope_alpha Numeric specifying transparency level of ROPE ribbon.
7-
#' @param rope_color Character specifying color of ROPE ribbon.
6+
#' @param alpha_rope Numeric specifying transparency level of ROPE ribbon.
7+
#' @param color_rope Character specifying color of ROPE ribbon.
88
#' @param show_intercept Logical, if `TRUE`, the intercept-parameter is included
99
#' in the plot. By default, it is hidden because in many cases the
1010
#' intercept-parameter has a posterior distribution on a very different
@@ -19,8 +19,8 @@
1919
#' @export
2020
plot.see_bayesfactor_parameters <- function(x,
2121
size_point = 2,
22-
rope_color = "#0171D3",
23-
rope_alpha = 0.2,
22+
color_rope = "#0171D3",
23+
alpha_rope = 0.2,
2424
show_intercept = FALSE,
2525
...) {
2626
if ("log_BF" %in% names(x) && !"BF" %in% names(x)) {
@@ -80,8 +80,8 @@ plot.see_bayesfactor_parameters <- function(x,
8080
xmax = rope[2],
8181
ymin = 0,
8282
ymax = Inf,
83-
fill = rope_color,
84-
alpha = rope_alpha
83+
fill = color_rope,
84+
alpha = alpha_rope
8585
)
8686
} else {
8787
p <- p +

R/plot.binned_residuals.R

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#' @export
22
plot.see_binned_residuals <- function(x,
3-
size_line = 0.7,
3+
linewidth = 0.7,
44
size_point = 2.2,
55
size_title = 12,
66
size_axis_title = base_size,
@@ -62,7 +62,7 @@ plot.see_binned_residuals <- function(x,
6262
se = FALSE,
6363
formula = y ~ s(x, bs = "tp"),
6464
colour = colors[3],
65-
linewidth = size_line
65+
linewidth = linewidth
6666
)
6767
}
6868

@@ -89,7 +89,7 @@ plot.see_binned_residuals <- function(x,
8989
ggplot2::geom_point(ggplot2::aes(y = .data$ybar), size = size_point) +
9090
ggplot2::geom_errorbar(
9191
ggplot2::aes(ymin = .data$CI_low, ymax = .data$CI_high),
92-
linewidth = size_line,
92+
linewidth = linewidth,
9393
width = 0
9494
)
9595
} else {
@@ -101,7 +101,7 @@ plot.see_binned_residuals <- function(x,
101101
ymax = .data$CI_high,
102102
colour = .data$group
103103
),
104-
linewidth = size_line,
104+
linewidth = linewidth,
105105
width = 0
106106
)
107107
}

R/plot.check_collinearity.R

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ plot.see_check_collinearity <- function(x,
1919
data = NULL,
2020
colors = c("#3aaf85", "#1b6ca8", "#cd201f"),
2121
size_point = 3.5,
22-
size_line = 0.8,
22+
linewidth = 0.8,
2323
size_title = 12,
2424
size_axis_title = base_size,
2525
base_size = 10,
@@ -53,7 +53,7 @@ plot.see_check_collinearity <- function(x,
5353
.plot_diag_vif(
5454
dat,
5555
size_point = size_point,
56-
size_line = size_line,
56+
linewidth = linewidth,
5757
size_title = size_title,
5858
size_axis_title = size_axis_title,
5959
base_size = base_size,
@@ -66,7 +66,7 @@ plot.see_check_collinearity <- function(x,
6666

6767
.plot_diag_vif <- function(x,
6868
size_point,
69-
size_line,
69+
linewidth,
7070
theme_style = theme_lucid,
7171
size_title = 12,
7272
size_axis_title = 10,
@@ -132,7 +132,7 @@ plot.see_check_collinearity <- function(x,
132132
if (!is.null(ci_data)) {
133133
p <- p +
134134
ggplot2::geom_linerange(
135-
linewidth = size_line,
135+
linewidth = linewidth,
136136
na.rm = TRUE
137137
) +
138138
ggplot2::geom_segment(

R/plot.check_heteroscedasticity.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
plot.see_check_heteroscedasticity <- function(x,
2020
data = NULL,
2121
size_point = 2,
22-
size_line = 0.8,
22+
linewidth = 0.8,
2323
size_title = 12,
2424
size_axis_title = base_size,
2525
base_size = 10,
@@ -79,7 +79,7 @@ plot.see_check_heteroscedasticity <- function(x,
7979
.plot_diag_homogeneity(
8080
dat,
8181
size_point = size_point,
82-
size_line = size_line,
82+
linewidth = linewidth,
8383
base_size = base_size,
8484
size_title = size_title,
8585
size_axis_title = size_axis_title,

R/plot.check_homogeneity.R

+4-4
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,14 @@ plot.see_check_homogeneity <- function(x, data = NULL, ...) {
133133

134134
.plot_diag_homogeneity <- function(x,
135135
size_point,
136-
size_line,
136+
linewidth,
137137
alpha_level = 0.2,
138138
theme_style = theme_lucid,
139139
size_title = 12,
140140
size_axis_title = 10,
141141
base_size = 10,
142142
colors = unname(social_colors(c("green", "blue", "red"))),
143-
dot_alpha_level = 0.8,
143+
alpha_dot = 0.8,
144144
show_dots = TRUE) {
145145
p <- ggplot2::ggplot(x, ggplot2::aes(x = .data$x, .data$y))
146146

@@ -149,7 +149,7 @@ plot.see_check_homogeneity <- function(x, data = NULL, ...) {
149149
geom_point2(
150150
colour = colors[2],
151151
size = size_point,
152-
alpha = dot_alpha_level
152+
alpha = alpha_dot
153153
)
154154
}
155155

@@ -159,7 +159,7 @@ plot.see_check_homogeneity <- function(x, data = NULL, ...) {
159159
se = TRUE,
160160
alpha = alpha_level,
161161
formula = y ~ x,
162-
linewidth = size_line,
162+
linewidth = linewidth,
163163
colour = colors[1]
164164
) +
165165
ggplot2::labs(

R/plot.check_model.R

+24-24
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ plot.see_check_model <- function(x,
3131
panel <- attr(x, "panel")
3232
check <- attr(x, "check")
3333
size_point <- attr(x, "dot_size")
34-
size_line <- attr(x, "line_size")
34+
linewidth <- attr(x, "line_size")
3535
show_labels <- attr(x, "show_labels") %||% TRUE
3636
size_text <- attr(x, "text_size")
3737
base_size <- attr(x, "base_size")
3838
size_axis_title <- attr(x, "axis_title_size")
3939
size_title <- attr(x, "title_size")
4040
alpha_level <- attr(x, "alpha")
41-
dot_alpha_level <- attr(x, "dot_alpha")
41+
alpha_dot <- attr(x, "alpha_dot")
4242
show_dots <- attr(x, "show_dots")
4343
detrend <- attr(x, "detrend")
4444
model_info <- attr(x, "model_info")
@@ -73,8 +73,8 @@ plot.see_check_model <- function(x,
7373
alpha_level <- 0.2
7474
}
7575

76-
if (is.null(dot_alpha_level)) {
77-
dot_alpha_level <- 0.8
76+
if (is.null(alpha_dot)) {
77+
alpha_dot <- 0.8
7878
}
7979

8080
if (is.null(base_size)) {
@@ -101,7 +101,7 @@ plot.see_check_model <- function(x,
101101
p$PP_CHECK <- plot.see_performance_pp_check(
102102
x$PP_CHECK,
103103
style = style,
104-
size_line = size_line,
104+
linewidth = linewidth,
105105
size_point = size_point,
106106
base_size = base_size,
107107
size_axis_title = size_axis_title,
@@ -117,14 +117,14 @@ plot.see_check_model <- function(x,
117117
p$NCV <- .plot_diag_linearity(
118118
x$NCV,
119119
size_point = size_point,
120-
size_line = size_line,
120+
linewidth = linewidth,
121121
alpha_level = alpha_level,
122122
theme_style = style,
123123
base_size = base_size,
124124
size_axis_title = size_axis_title,
125125
size_title = size_title,
126126
colors = colors,
127-
dot_alpha_level = dot_alpha_level,
127+
alpha_dot = alpha_dot,
128128
show_dots = show_dots
129129
)
130130
}
@@ -152,7 +152,7 @@ plot.see_check_model <- function(x,
152152
size_axis_title = size_axis_title,
153153
size_title = size_title,
154154
colors = colors[c(1, 2)],
155-
size_line = size_line,
155+
linewidth = linewidth,
156156
type = overdisp_type
157157
)
158158
}
@@ -161,14 +161,14 @@ plot.see_check_model <- function(x,
161161
p$HOMOGENEITY <- .plot_diag_homogeneity(
162162
x$HOMOGENEITY,
163163
size_point = size_point,
164-
size_line = size_line,
164+
linewidth = linewidth,
165165
alpha_level = alpha_level,
166166
theme_style = style,
167167
base_size = base_size,
168168
size_axis_title = size_axis_title,
169169
size_title = size_title,
170170
colors = colors,
171-
dot_alpha_level = dot_alpha_level,
171+
alpha_dot = alpha_dot,
172172
show_dots = show_dots
173173
)
174174
}
@@ -178,14 +178,14 @@ plot.see_check_model <- function(x,
178178
x$INFLUENTIAL,
179179
show_labels = show_labels,
180180
size_text = size_text,
181-
size_line = size_line,
181+
linewidth = linewidth,
182182
size_point = size_point,
183183
theme_style = style,
184184
size_axis_title = size_axis_title,
185185
size_title = size_title,
186186
base_size = base_size,
187187
colors = colors,
188-
dot_alpha_level = dot_alpha_level,
188+
alpha_dot = alpha_dot,
189189
show_dots = show_dots
190190
)
191191
}
@@ -194,7 +194,7 @@ plot.see_check_model <- function(x,
194194
p$VIF <- .plot_diag_vif(
195195
x$VIF,
196196
size_point = 1.5 * size_point,
197-
size_line = size_line,
197+
linewidth = linewidth,
198198
theme_style = style,
199199
base_size = base_size,
200200
size_axis_title = size_axis_title,
@@ -209,10 +209,10 @@ plot.see_check_model <- function(x,
209209
if (inherits(x$QQ, "performance_simres")) {
210210
p$QQ <- plot(
211211
x$QQ,
212-
size_line = size_line,
212+
linewidth = linewidth,
213213
size_point = 0.9 * size_point,
214214
alpha = alpha_level,
215-
dot_alpha = dot_alpha_level,
215+
alpha_dot = alpha_dot,
216216
colors = colors,
217217
detrend = detrend,
218218
style = style,
@@ -224,15 +224,15 @@ plot.see_check_model <- function(x,
224224
p$QQ <- .plot_diag_qq(
225225
x$QQ,
226226
size_point = size_point,
227-
size_line = size_line,
227+
linewidth = linewidth,
228228
size_axis_title = size_axis_title,
229229
size_title = size_title,
230230
alpha_level = alpha_level,
231231
detrend = detrend,
232232
theme_style = style,
233233
base_size = base_size,
234234
colors = colors,
235-
dot_alpha_level = dot_alpha_level,
235+
alpha_dot = alpha_dot,
236236
show_dots = TRUE, # qq-plots w/o dots makes no sense
237237
model_info = model_info,
238238
model_class = model_class
@@ -243,7 +243,7 @@ plot.see_check_model <- function(x,
243243
if ("NORM" %in% names(x) && !is.null(x$NORM) && any(c("normality", "all") %in% check)) {
244244
p$NORM <- .plot_diag_norm(
245245
x$NORM,
246-
size_line = size_line,
246+
linewidth = linewidth,
247247
alpha_level = alpha_level,
248248
theme_style = style,
249249
base_size = base_size,
@@ -257,14 +257,14 @@ plot.see_check_model <- function(x,
257257
ps <- .plot_diag_reqq(
258258
x$REQQ,
259259
size_point,
260-
size_line,
260+
linewidth,
261261
size_axis_title = size_axis_title,
262262
size_title = size_title,
263263
alpha_level = alpha_level,
264264
theme_style = style,
265265
base_size = base_size,
266266
colors = colors,
267-
dot_alpha_level = dot_alpha_level,
267+
alpha_dot = alpha_dot,
268268
show_dots = TRUE # qq-plots w/o dots makes no sense
269269
)
270270

@@ -285,14 +285,14 @@ plot.see_check_model <- function(x,
285285

286286
.plot_diag_linearity <- function(x,
287287
size_point,
288-
size_line,
288+
linewidth,
289289
size_axis_title = 10,
290290
size_title = 12,
291291
alpha_level = 0.2,
292292
theme_style = theme_lucid,
293293
base_size = 10,
294294
colors = unname(social_colors(c("green", "blue", "red"))),
295-
dot_alpha_level = 0.8,
295+
alpha_dot = 0.8,
296296
show_dots = TRUE) {
297297
p <- ggplot2::ggplot(x, ggplot2::aes(x = .data$x, y = .data$y))
298298

@@ -301,7 +301,7 @@ plot.see_check_model <- function(x,
301301
geom_point2(
302302
colour = colors[2],
303303
size = size_point,
304-
alpha = dot_alpha_level
304+
alpha = alpha_dot
305305
)
306306
}
307307

@@ -311,7 +311,7 @@ plot.see_check_model <- function(x,
311311
se = TRUE,
312312
formula = y ~ x,
313313
alpha = alpha_level,
314-
linewidth = size_line,
314+
linewidth = linewidth,
315315
colour = colors[1]
316316
) +
317317
ggplot2::geom_hline(yintercept = 0, linetype = "dashed") +

0 commit comments

Comments
 (0)