Skip to content

Commit

Permalink
Update labeling and defaults
Browse files Browse the repository at this point in the history
- Make titles for p-p plots parallel to those for q-q plots
- Change default to `type = "qq"`
- Add details for the `type` argument to documentation (and add similar details for functions that previously imported the `type` argument from `plot.see_check_normality`
  • Loading branch information
bwiernik committed Jul 23, 2023
1 parent 5198578 commit fcb386b
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 18 deletions.
18 changes: 11 additions & 7 deletions R/plot.check_normality.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
#' function.
#'
#' @param type Character vector, indicating the type of plot.
#' Options are `"qq"` (default) for quantile-quantile (Q-Q) plots,
#' `"pp"` for probability-probability (P-P) plots, or
#' `"density"` for density overlay plots.
#' @param size_line Numeric value specifying size of line geoms.
#' @param dot_alpha Numeric value specifying alpha level of the point geoms.
#' @param alpha Numeric value specifying alpha level of the confidence bands.
#' @param colors Character vector of length two, indicating the colors (in
#' hex-format) for points and line.
#' @param detrend Logical that decides if the plot should be detrended.
#' @param detrend Logical that decides if Q-Q and P-P plots should be de-trended.
#' Defaults to `TRUE` if the *qqplotr* package is installed and `FALSE` otherwise.
#' @param method The method used for estimating the qq/pp bands. Default to
#' `"ell"` (equal local levels / simultaneous testing - recommended). Can also
#' be one of `"pointwise"` or `"boot"` for pointwise confidence bands, or
Expand All @@ -32,14 +36,14 @@
#'
#' @export
plot.see_check_normality <- function(x,
type = c("density", "qq", "pp"),
type = c("qq", "pp", "density"),
data = NULL,
size_line = 0.8,
size_point = 2,
alpha = 0.2,
dot_alpha = 0.8,
colors = c("#3aaf85", "#1b6ca8"),
detrend = FALSE,
detrend = requireNamespace("qqplotr", quietly = TRUE),
method = "ell",
...) {
type <- match.arg(type)
Expand Down Expand Up @@ -302,15 +306,15 @@ plot.see_check_normality <- function(x,
alpha = dot_alpha_level
) # "#2c3e50"
} else {
stop("Package 'qqplotr' OR 'MASS' required for PP-plots. Please install one of them.", call. = FALSE)
stop("Package 'qqplotr' OR 'MASS' required for P-P plots. Please install one of them.", call. = FALSE)
}

p_plot +
ggplot2::labs(
title = "Normality of Residuals (PP plot)",
title = "Normality of Residuals",
subtitle = "Dots should fall along the line",
y = "Cummulative Probability",
x = "Probability Points"
y = "Sample Cummulative Probability",
x = "Standard Normal Cumulative Probability"
) +
theme_style(
base_size = 10,
Expand Down
6 changes: 6 additions & 0 deletions R/plot.check_outliers.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
#' The `plot()` method for the `performance::check_outliers()`
#' function.
#'
#' @param type Character vector, indicating the type of plot.
#' Options are `"dots"` (default) for a scatterplot of leverage (hat) values
#' versus residuals, with Cook's Distance contours for evaluating influential
#' points, or `"bars"` for a bar chart of (rescaled) outlier statistic values
#' for each data point. Only used for outlier plots of fitted models; for
#' outlier plots of raw data values, `type = "bars"` is always used.
#' @param show_labels Logical. If `TRUE`, text labels are displayed.
#' @param size_text Numeric value specifying size of text labels.
#' @param rescale_distance Logical. If `TRUE`, distance values are rescaled
Expand Down
6 changes: 6 additions & 0 deletions R/plot.n_factors.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ data_plot.n_clusters <- data_plot.n_factors
#'
#' The `plot()` method for the `parameters::n_factors()` and `parameters::n_clusters()`
#'
#' @param type Character vector, indicating the type of plot.
#' Options are three different shapes to illustrate the degree of consensus
#' between dimensionality methods for each number of factors;
#' `"bar"` (default) for a bar chart,
#' `"line"` for a horizontal point and line chart, or
#' `"area"` for an area chart (frequency polygon).
#' @param size Depending on `type`, a numeric value specifying size of bars,
#' lines, or segments.
#' @inheritParams data_plot
Expand Down
4 changes: 4 additions & 0 deletions R/plot.parameters_pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ data_plot.parameters_efa <- data_plot.parameters_pca
#'
#' The `plot()` method for the `parameters::principal_components()` function.
#'
#' @param type Character vector, indicating the type of plot.
#' Options are three different shapes to represent component loadings;
#' `"bar"` (default) for a horizontal bar chart, or
#' `"line"` for a horizontal point and line chart.
#' @param text_color Character specifying color of text labels.
#' @inheritParams data_plot
#' @inheritParams plot.see_bayesfactor_parameters
Expand Down
12 changes: 8 additions & 4 deletions man/plot.see_check_normality.Rd

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

7 changes: 6 additions & 1 deletion man/plot.see_check_outliers.Rd

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

7 changes: 6 additions & 1 deletion man/plot.see_n_factors.Rd

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

5 changes: 4 additions & 1 deletion man/plot.see_parameters_pca.Rd

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

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fcb386b

Please sign in to comment.