From 29c6b02ce63f6ecb17e496605e9982901231bcb8 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 29 Jun 2026 09:28:01 +0200 Subject: [PATCH 1/5] Add tests to check that `theme` argument works in `check_model()` --- DESCRIPTION | 2 +- .../check-model-different-theme-1.svg | 615 +++++++++++++++++ .../check-model-different-theme-2.svg | 615 +++++++++++++++++ .../check-model-theme-attr-2.svg | 612 +++++++++++++++++ .../check-model-theme-attr-3.svg | 549 ++++++++++++++++ .../check-model-theme-attr.svg | 612 +++++++++++++++++ .../check-model-theme-bw-string.svg | 618 ++++++++++++++++++ .../check-model-theme-bw.svg | 618 ++++++++++++++++++ .../check-model-theme-custom-style.svg | 569 ++++++++++++++++ .../check-model-theme-custom.svg | 549 ++++++++++++++++ .../check-model-theme-dark-string.svg | 612 +++++++++++++++++ .../check-model-theme-minimal.svg | 549 ++++++++++++++++ .../check-model-without-theme.svg | 569 ++++++++++++++++ tests/testthat/test-check_model_theme.R | 201 ++++++ 14 files changed, 7289 insertions(+), 1 deletion(-) create mode 100644 tests/testthat/_snaps/check_model_theme/check-model-different-theme-1.svg create mode 100644 tests/testthat/_snaps/check_model_theme/check-model-different-theme-2.svg create mode 100644 tests/testthat/_snaps/check_model_theme/check-model-theme-attr-2.svg create mode 100644 tests/testthat/_snaps/check_model_theme/check-model-theme-attr-3.svg create mode 100644 tests/testthat/_snaps/check_model_theme/check-model-theme-attr.svg create mode 100644 tests/testthat/_snaps/check_model_theme/check-model-theme-bw-string.svg create mode 100644 tests/testthat/_snaps/check_model_theme/check-model-theme-bw.svg create mode 100644 tests/testthat/_snaps/check_model_theme/check-model-theme-custom-style.svg create mode 100644 tests/testthat/_snaps/check_model_theme/check-model-theme-custom.svg create mode 100644 tests/testthat/_snaps/check_model_theme/check-model-theme-dark-string.svg create mode 100644 tests/testthat/_snaps/check_model_theme/check-model-theme-minimal.svg create mode 100644 tests/testthat/_snaps/check_model_theme/check-model-without-theme.svg create mode 100644 tests/testthat/test-check_model_theme.R diff --git a/DESCRIPTION b/DESCRIPTION index 7bf4f1f4d..09996d4b3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: see Title: Model Visualisation Toolbox for 'easystats' and 'ggplot2' -Version: 0.14.0.9 +Version: 0.14.0.10 Authors@R: c(person(given = "Daniel", family = "Lüdecke", diff --git a/tests/testthat/_snaps/check_model_theme/check-model-different-theme-1.svg b/tests/testthat/_snaps/check_model_theme/check-model-different-theme-1.svg new file mode 100644 index 000000000..1bef42530 --- /dev/null +++ b/tests/testthat/_snaps/check_model_theme/check-model-different-theme-1.svg @@ -0,0 +1,615 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.00 +0.02 +0.04 +0.06 +0.08 + + + + + + + + +10 +20 +30 +mpg +Density + + + + + +Observed data +Model-predicted data +Model-predicted lines should resemble observed data line +Posterior Predictive Check + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-3 +0 +3 +6 + + + + + + + + +10 +15 +20 +25 +Fitted values +Residuals +Reference line should be flat and horizontal +Linearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.4 +0.8 +1.2 +1.6 + + + + + + + + +10 +15 +20 +25 +Fitted values + +|Std. residuals| +Reference line should be flat and horizontal +Homogeneity of Variance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +21 +17 +20 +18 +25 + + +0.9 +0.9 + + +-8 +-4 +0 +4 +8 + + + + + + + + + +0.0 +0.1 +0.2 +0.3 +Leverage ( +h +i +i +) +Std. Residuals +Points should be inside the contour lines +Influential Observations + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1 +2 +3 +5 +10 + + + + + + + + + +cyl +disp +gear +wt +Variance Inflation +Factor (VIF, log-scaled) + + + + + + + +Low (< 5) +Moderate (< 10) +High collinearity (VIF) may inflate parameter uncertainty +Collinearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-2 +-1 +0 +1 +2 + + + + + + + + + + +-2 +-1 +0 +1 +2 +Standard Normal Distribution Quantiles +Sample Quantile Deviations +Dots should fall along the line +Normality of Residuals +check_model-different_theme-1 + + diff --git a/tests/testthat/_snaps/check_model_theme/check-model-different-theme-2.svg b/tests/testthat/_snaps/check_model_theme/check-model-different-theme-2.svg new file mode 100644 index 000000000..5d098d0ac --- /dev/null +++ b/tests/testthat/_snaps/check_model_theme/check-model-different-theme-2.svg @@ -0,0 +1,615 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.00 +0.02 +0.04 +0.06 +0.08 + + + + + + + + +10 +20 +30 +mpg +Density + + + + + +Observed data +Model-predicted data +Model-predicted lines should resemble observed data line +Posterior Predictive Check + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-3 +0 +3 +6 + + + + + + + + +10 +15 +20 +25 +Fitted values +Residuals +Reference line should be flat and horizontal +Linearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.4 +0.8 +1.2 +1.6 + + + + + + + + +10 +15 +20 +25 +Fitted values + +|Std. residuals| +Reference line should be flat and horizontal +Homogeneity of Variance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +21 +17 +20 +18 +25 + + +0.9 +0.9 + + +-8 +-4 +0 +4 +8 + + + + + + + + + +0.0 +0.1 +0.2 +0.3 +Leverage ( +h +i +i +) +Std. Residuals +Points should be inside the contour lines +Influential Observations + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1 +2 +3 +5 +10 + + + + + + + + + +cyl +disp +gear +wt +Variance Inflation +Factor (VIF, log-scaled) + + + + + + + +Low (< 5) +Moderate (< 10) +High collinearity (VIF) may inflate parameter uncertainty +Collinearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-2 +-1 +0 +1 +2 + + + + + + + + + + +-2 +-1 +0 +1 +2 +Standard Normal Distribution Quantiles +Sample Quantile Deviations +Dots should fall along the line +Normality of Residuals +check_model-different_theme-2 + + diff --git a/tests/testthat/_snaps/check_model_theme/check-model-theme-attr-2.svg b/tests/testthat/_snaps/check_model_theme/check-model-theme-attr-2.svg new file mode 100644 index 000000000..b6b2a61d4 --- /dev/null +++ b/tests/testthat/_snaps/check_model_theme/check-model-theme-attr-2.svg @@ -0,0 +1,612 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.00 +0.02 +0.04 +0.06 + + + + + + + +10 +20 +30 +mpg +Density + + + + + +Observed data +Model-predicted data +Model-predicted lines should resemble observed data line +Posterior Predictive Check + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-3 +0 +3 +6 + + + + + + + + +10 +15 +20 +25 +Fitted values +Residuals +Reference line should be flat and horizontal +Linearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.4 +0.8 +1.2 +1.6 + + + + + + + + +10 +15 +20 +25 +Fitted values + +|Std. residuals| +Reference line should be flat and horizontal +Homogeneity of Variance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +21 +17 +20 +18 +25 + + +0.9 +0.9 + + +-8 +-4 +0 +4 +8 + + + + + + + + + +0.0 +0.1 +0.2 +0.3 +Leverage ( +h +i +i +) +Std. Residuals +Points should be inside the contour lines +Influential Observations + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1 +2 +3 +5 +10 + + + + + + + + + +cyl +disp +gear +wt +Variance Inflation +Factor (VIF, log-scaled) + + + + + + + +Low (< 5) +Moderate (< 10) +High collinearity (VIF) may inflate parameter uncertainty +Collinearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-2 +-1 +0 +1 +2 + + + + + + + + + + +-2 +-1 +0 +1 +2 +Standard Normal Distribution Quantiles +Sample Quantile Deviations +Dots should fall along the line +Normality of Residuals +check_model-theme_attr-2 + + diff --git a/tests/testthat/_snaps/check_model_theme/check-model-theme-attr-3.svg b/tests/testthat/_snaps/check_model_theme/check-model-theme-attr-3.svg new file mode 100644 index 000000000..9e9d60936 --- /dev/null +++ b/tests/testthat/_snaps/check_model_theme/check-model-theme-attr-3.svg @@ -0,0 +1,549 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.00 +0.02 +0.04 +0.06 +10 +20 +30 +mpg +Density + + +Observed data +Model-predicted data +Model-predicted lines should resemble observed data line +Posterior Predictive Check + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-3 +0 +3 +6 +10 +15 +20 +25 +Fitted values +Residuals +Reference line should be flat and horizontal +Linearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.4 +0.8 +1.2 +1.6 +10 +15 +20 +25 +Fitted values + +|Std. residuals| +Reference line should be flat and horizontal +Homogeneity of Variance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +21 +17 +20 +18 +25 + + +0.9 +0.9 + + +-8 +-4 +0 +4 +8 +0.0 +0.1 +0.2 +0.3 +Leverage ( +h +i +i +) +Std. Residuals +Points should be inside the contour lines +Influential Observations + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1 +2 +3 +5 +10 +cyl +disp +gear +wt +Variance Inflation +Factor (VIF, log-scaled) + + + + +Low (< 5) +Moderate (< 10) +High collinearity (VIF) may inflate parameter uncertainty +Collinearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-2 +-1 +0 +1 +2 +-2 +-1 +0 +1 +2 +Standard Normal Distribution Quantiles +Sample Quantile Deviations +Dots should fall along the line +Normality of Residuals +check_model-theme_attr-3 + + diff --git a/tests/testthat/_snaps/check_model_theme/check-model-theme-attr.svg b/tests/testthat/_snaps/check_model_theme/check-model-theme-attr.svg new file mode 100644 index 000000000..e33232261 --- /dev/null +++ b/tests/testthat/_snaps/check_model_theme/check-model-theme-attr.svg @@ -0,0 +1,612 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.00 +0.02 +0.04 +0.06 + + + + + + + +10 +20 +30 +mpg +Density + + + + + +Observed data +Model-predicted data +Model-predicted lines should resemble observed data line +Posterior Predictive Check + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-3 +0 +3 +6 + + + + + + + + +10 +15 +20 +25 +Fitted values +Residuals +Reference line should be flat and horizontal +Linearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.4 +0.8 +1.2 +1.6 + + + + + + + + +10 +15 +20 +25 +Fitted values + +|Std. residuals| +Reference line should be flat and horizontal +Homogeneity of Variance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +21 +17 +20 +18 +25 + + +0.9 +0.9 + + +-8 +-4 +0 +4 +8 + + + + + + + + + +0.0 +0.1 +0.2 +0.3 +Leverage ( +h +i +i +) +Std. Residuals +Points should be inside the contour lines +Influential Observations + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1 +2 +3 +5 +10 + + + + + + + + + +cyl +disp +gear +wt +Variance Inflation +Factor (VIF, log-scaled) + + + + + + + +Low (< 5) +Moderate (< 10) +High collinearity (VIF) may inflate parameter uncertainty +Collinearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-2 +-1 +0 +1 +2 + + + + + + + + + + +-2 +-1 +0 +1 +2 +Standard Normal Distribution Quantiles +Sample Quantile Deviations +Dots should fall along the line +Normality of Residuals +check_model-theme_attr + + diff --git a/tests/testthat/_snaps/check_model_theme/check-model-theme-bw-string.svg b/tests/testthat/_snaps/check_model_theme/check-model-theme-bw-string.svg new file mode 100644 index 000000000..ffcae363e --- /dev/null +++ b/tests/testthat/_snaps/check_model_theme/check-model-theme-bw-string.svg @@ -0,0 +1,618 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.00 +0.02 +0.04 +0.06 + + + + + + + +10 +20 +30 +mpg +Density + + + + + +Observed data +Model-predicted data +Model-predicted lines should resemble observed data line +Posterior Predictive Check + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-3 +0 +3 +6 + + + + + + + + +10 +15 +20 +25 +Fitted values +Residuals +Reference line should be flat and horizontal +Linearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.4 +0.8 +1.2 +1.6 + + + + + + + + +10 +15 +20 +25 +Fitted values + +|Std. residuals| +Reference line should be flat and horizontal +Homogeneity of Variance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +21 +17 +20 +18 +25 + + +0.9 +0.9 + + + +-8 +-4 +0 +4 +8 + + + + + + + + + +0.0 +0.1 +0.2 +0.3 +Leverage ( +h +i +i +) +Std. Residuals +Points should be inside the contour lines +Influential Observations + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1 +2 +3 +5 +10 + + + + + + + + + +cyl +disp +gear +wt +Variance Inflation +Factor (VIF, log-scaled) + + + + + + + +Low (< 5) +Moderate (< 10) +High collinearity (VIF) may inflate parameter uncertainty +Collinearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-2 +-1 +0 +1 +2 + + + + + + + + + + +-2 +-1 +0 +1 +2 +Standard Normal Distribution Quantiles +Sample Quantile Deviations +Dots should fall along the line +Normality of Residuals +check_model-theme_bw_string + + diff --git a/tests/testthat/_snaps/check_model_theme/check-model-theme-bw.svg b/tests/testthat/_snaps/check_model_theme/check-model-theme-bw.svg new file mode 100644 index 000000000..52a35bf36 --- /dev/null +++ b/tests/testthat/_snaps/check_model_theme/check-model-theme-bw.svg @@ -0,0 +1,618 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.00 +0.02 +0.04 +0.06 + + + + + + + +10 +20 +30 +mpg +Density + + + + + +Observed data +Model-predicted data +Model-predicted lines should resemble observed data line +Posterior Predictive Check + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-3 +0 +3 +6 + + + + + + + + +10 +15 +20 +25 +Fitted values +Residuals +Reference line should be flat and horizontal +Linearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.4 +0.8 +1.2 +1.6 + + + + + + + + +10 +15 +20 +25 +Fitted values + +|Std. residuals| +Reference line should be flat and horizontal +Homogeneity of Variance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +21 +17 +20 +18 +25 + + +0.9 +0.9 + + + +-8 +-4 +0 +4 +8 + + + + + + + + + +0.0 +0.1 +0.2 +0.3 +Leverage ( +h +i +i +) +Std. Residuals +Points should be inside the contour lines +Influential Observations + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1 +2 +3 +5 +10 + + + + + + + + + +cyl +disp +gear +wt +Variance Inflation +Factor (VIF, log-scaled) + + + + + + + +Low (< 5) +Moderate (< 10) +High collinearity (VIF) may inflate parameter uncertainty +Collinearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-2 +-1 +0 +1 +2 + + + + + + + + + + +-2 +-1 +0 +1 +2 +Standard Normal Distribution Quantiles +Sample Quantile Deviations +Dots should fall along the line +Normality of Residuals +check_model-theme_bw + + diff --git a/tests/testthat/_snaps/check_model_theme/check-model-theme-custom-style.svg b/tests/testthat/_snaps/check_model_theme/check-model-theme-custom-style.svg new file mode 100644 index 000000000..6b15d0118 --- /dev/null +++ b/tests/testthat/_snaps/check_model_theme/check-model-theme-custom-style.svg @@ -0,0 +1,569 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.00 +0.02 +0.04 +0.06 + +10 +20 +30 +mpg +Density + + + +Observed data +Model-predicted data +Model-predicted lines should resemble observed data line +Posterior Predictive Check + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-3 +0 +3 +6 + +10 +15 +20 +25 +Fitted values +Residuals +Reference line should be flat and horizontal +Linearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.4 +0.8 +1.2 +1.6 + +10 +15 +20 +25 +Fitted values + +|Std. residuals| +Reference line should be flat and horizontal +Homogeneity of Variance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +21 +17 +20 +18 +25 + + +0.9 +0.9 + + + +-8 +-4 +0 +4 +8 + +0.0 +0.1 +0.2 +0.3 +Leverage ( +h +i +i +) +Std. Residuals +Points should be inside the contour lines +Influential Observations + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1 +2 +3 +5 +10 + +cyl +disp +gear +wt +Variance Inflation +Factor (VIF, log-scaled) + + + + + +Low (< 5) +Moderate (< 10) +High collinearity (VIF) may inflate parameter uncertainty +Collinearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-2 +-1 +0 +1 +2 + +-2 +-1 +0 +1 +2 +Standard Normal Distribution Quantiles +Sample Quantile Deviations +Dots should fall along the line +Normality of Residuals +check_model-theme_custom_style + + diff --git a/tests/testthat/_snaps/check_model_theme/check-model-theme-custom.svg b/tests/testthat/_snaps/check_model_theme/check-model-theme-custom.svg new file mode 100644 index 000000000..602265524 --- /dev/null +++ b/tests/testthat/_snaps/check_model_theme/check-model-theme-custom.svg @@ -0,0 +1,549 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.00 +0.02 +0.04 +0.06 +10 +20 +30 +mpg +Density + + +Observed data +Model-predicted data +Model-predicted lines should resemble observed data line +Posterior Predictive Check + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-3 +0 +3 +6 +10 +15 +20 +25 +Fitted values +Residuals +Reference line should be flat and horizontal +Linearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.4 +0.8 +1.2 +1.6 +10 +15 +20 +25 +Fitted values + +|Std. residuals| +Reference line should be flat and horizontal +Homogeneity of Variance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +21 +17 +20 +18 +25 + + +0.9 +0.9 + + +-8 +-4 +0 +4 +8 +0.0 +0.1 +0.2 +0.3 +Leverage ( +h +i +i +) +Std. Residuals +Points should be inside the contour lines +Influential Observations + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1 +2 +3 +5 +10 +cyl +disp +gear +wt +Variance Inflation +Factor (VIF, log-scaled) + + + + +Low (< 5) +Moderate (< 10) +High collinearity (VIF) may inflate parameter uncertainty +Collinearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-2 +-1 +0 +1 +2 +-2 +-1 +0 +1 +2 +Standard Normal Distribution Quantiles +Sample Quantile Deviations +Dots should fall along the line +Normality of Residuals +check_model-theme_custom + + diff --git a/tests/testthat/_snaps/check_model_theme/check-model-theme-dark-string.svg b/tests/testthat/_snaps/check_model_theme/check-model-theme-dark-string.svg new file mode 100644 index 000000000..6f1f34072 --- /dev/null +++ b/tests/testthat/_snaps/check_model_theme/check-model-theme-dark-string.svg @@ -0,0 +1,612 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.00 +0.02 +0.04 +0.06 + + + + + + + +10 +20 +30 +mpg +Density + + + + + +Observed data +Model-predicted data +Model-predicted lines should resemble observed data line +Posterior Predictive Check + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-3 +0 +3 +6 + + + + + + + + +10 +15 +20 +25 +Fitted values +Residuals +Reference line should be flat and horizontal +Linearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.4 +0.8 +1.2 +1.6 + + + + + + + + +10 +15 +20 +25 +Fitted values + +|Std. residuals| +Reference line should be flat and horizontal +Homogeneity of Variance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +21 +17 +20 +18 +25 + + +0.9 +0.9 + + +-8 +-4 +0 +4 +8 + + + + + + + + + +0.0 +0.1 +0.2 +0.3 +Leverage ( +h +i +i +) +Std. Residuals +Points should be inside the contour lines +Influential Observations + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1 +2 +3 +5 +10 + + + + + + + + + +cyl +disp +gear +wt +Variance Inflation +Factor (VIF, log-scaled) + + + + + + + +Low (< 5) +Moderate (< 10) +High collinearity (VIF) may inflate parameter uncertainty +Collinearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-2 +-1 +0 +1 +2 + + + + + + + + + + +-2 +-1 +0 +1 +2 +Standard Normal Distribution Quantiles +Sample Quantile Deviations +Dots should fall along the line +Normality of Residuals +check_model-theme_dark_string + + diff --git a/tests/testthat/_snaps/check_model_theme/check-model-theme-minimal.svg b/tests/testthat/_snaps/check_model_theme/check-model-theme-minimal.svg new file mode 100644 index 000000000..4252fc96d --- /dev/null +++ b/tests/testthat/_snaps/check_model_theme/check-model-theme-minimal.svg @@ -0,0 +1,549 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.00 +0.02 +0.04 +0.06 +10 +20 +30 +mpg +Density + + +Observed data +Model-predicted data +Model-predicted lines should resemble observed data line +Posterior Predictive Check + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-3 +0 +3 +6 +10 +15 +20 +25 +Fitted values +Residuals +Reference line should be flat and horizontal +Linearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.4 +0.8 +1.2 +1.6 +10 +15 +20 +25 +Fitted values + +|Std. residuals| +Reference line should be flat and horizontal +Homogeneity of Variance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +21 +17 +20 +18 +25 + + +0.9 +0.9 + + +-8 +-4 +0 +4 +8 +0.0 +0.1 +0.2 +0.3 +Leverage ( +h +i +i +) +Std. Residuals +Points should be inside the contour lines +Influential Observations + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1 +2 +3 +5 +10 +cyl +disp +gear +wt +Variance Inflation +Factor (VIF, log-scaled) + + + + +Low (< 5) +Moderate (< 10) +High collinearity (VIF) may inflate parameter uncertainty +Collinearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-2 +-1 +0 +1 +2 +-2 +-1 +0 +1 +2 +Standard Normal Distribution Quantiles +Sample Quantile Deviations +Dots should fall along the line +Normality of Residuals +check_model-theme_minimal + + diff --git a/tests/testthat/_snaps/check_model_theme/check-model-without-theme.svg b/tests/testthat/_snaps/check_model_theme/check-model-without-theme.svg new file mode 100644 index 000000000..11387a546 --- /dev/null +++ b/tests/testthat/_snaps/check_model_theme/check-model-without-theme.svg @@ -0,0 +1,569 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.00 +0.02 +0.04 +0.06 + +10 +20 +30 +mpg +Density + + + +Observed data +Model-predicted data +Model-predicted lines should resemble observed data line +Posterior Predictive Check + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-3 +0 +3 +6 + +10 +15 +20 +25 +Fitted values +Residuals +Reference line should be flat and horizontal +Linearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.4 +0.8 +1.2 +1.6 + +10 +15 +20 +25 +Fitted values + +|Std. residuals| +Reference line should be flat and horizontal +Homogeneity of Variance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +21 +17 +20 +18 +25 + + +0.9 +0.9 + + + +-8 +-4 +0 +4 +8 + +0.0 +0.1 +0.2 +0.3 +Leverage ( +h +i +i +) +Std. Residuals +Points should be inside the contour lines +Influential Observations + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1 +2 +3 +5 +10 + +cyl +disp +gear +wt +Variance Inflation +Factor (VIF, log-scaled) + + + + + +Low (< 5) +Moderate (< 10) +High collinearity (VIF) may inflate parameter uncertainty +Collinearity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-2 +-1 +0 +1 +2 + +-2 +-1 +0 +1 +2 +Standard Normal Distribution Quantiles +Sample Quantile Deviations +Dots should fall along the line +Normality of Residuals +check_model-without_theme + + diff --git a/tests/testthat/test-check_model_theme.R b/tests/testthat/test-check_model_theme.R new file mode 100644 index 000000000..726dcee57 --- /dev/null +++ b/tests/testthat/test-check_model_theme.R @@ -0,0 +1,201 @@ +skip_on_cran() +skip_if_not_installed("performance") +skip_if_not_installed("ggplot2") + +expect_doppelganger_with_seed <- function(title, fig, seed = 123) { + set.seed(seed) + vdiffr::expect_doppelganger(title = title, fig = fig) +} + +# ============================================================================== +# ISSUE #851: theme argument of performance::check_model() has no effect +# ============================================================================== +# +# These tests document the expected behavior of the theme argument in +# performance::check_model(). Currently, these tests FAIL due to bugs in the see package's +# plot.performance::check_model() function. +# +# Three main problems identified: +# 1. Standard ggplot2 themes cause "unused arguments" errors +# 2. Custom user-defined theme functions cannot be accessed +# 3. Theme attribute not properly read by see package's plot method +# +# The actual fix needs to be implemented in the see package's +# R/plot.performance::check_model.R file (around lines 64-67). +# +# See: https://github.com/easystats/performance/issues/851 +# ============================================================================== + +# Test 1: Standard ggplot2 themes should work without errors +# ----------------------------------------------------------------------------- +# PROBLEM: Currently throws "unused arguments" error because see package passes +# hardcoded arguments (plot.title.space, axis.title.space, etc.) that don't +# exist in standard ggplot2 themes. +test_that("performance::check_model accepts standard ggplot2 themes as functions", { + m <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) + + # Test with theme_dark passed as function (not string) + # Explicit namespace call for clarity and to avoid conflicts + p1 <- performance::check_model(m, theme = ggplot2::theme_dark()) + # The plot method should handle the theme attribute correctly + expect_doppelganger_with_seed( + title = "check_model-theme_attr", + fig = plot(p1) + ) + + # Test with theme_minimal + p2 <- performance::check_model(m, theme = ggplot2::theme_minimal()) + expect_doppelganger_with_seed( + title = "check_model-theme_minimal", + fig = plot(p2) + ) + + # Test with theme_bw + p3 <- performance::check_model(m, theme = ggplot2::theme_bw()) + expect_doppelganger_with_seed( + title = "check_model-theme_bw", + fig = plot(p3) + ) +}) + + +# Test 2: Theme as string should work for backward compatibility +# ----------------------------------------------------------------------------- +# PROBLEM: String parsing doesn't work reliably, and when it does parse, +# it still hits the "unused arguments" error from hardcoded parameters. +test_that("performance::check_model accepts theme as string (backward compatibility)", { + m <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) + + # String reference should work + p1 <- performance::check_model(m, theme = "ggplot2::theme_dark") + expect_doppelganger_with_seed( + title = "check_model-theme_dark_string", + fig = plot(p1) + ) + + # Test with theme_bw as string + p2 <- performance::check_model(m, theme = "ggplot2::theme_bw") + expect_doppelganger_with_seed( + title = "check_model-theme_bw_string", + fig = plot(p2) + ) +}) + + +# Test 3: Custom theme functions should work +# ----------------------------------------------------------------------------- +# PROBLEM: Custom themes defined in user environment can't be accessed because +# the see package's string parsing approach only searches package namespaces. +test_that("performance::check_model accepts custom theme functions from user environment", { + # Define custom theme in test environment + my_custom_theme <- function( + base_size = 11, + base_family = "", + base_line_size = base_size / 22, + base_rect_size = base_size / 22 + ) { + ggplot2::theme_minimal( + base_size = base_size, + base_family = base_family, + base_line_size = base_line_size, + base_rect_size = base_rect_size + ) + + ggplot2::theme( + plot.title = ggplot2::element_text(size = 16, face = "bold"), + panel.grid.major = ggplot2::element_line(color = "gray80") + ) + } + + m <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) + + # Custom theme function should work when passed directly + p1 <- performance::check_model(m, theme = my_custom_theme()) + expect_doppelganger_with_seed( + title = "check_model-theme_custom", + fig = plot(p1) + ) + + # Also test passing custom theme to plot method's style argument + p2 <- performance::check_model(m) + expect_doppelganger_with_seed( + title = "check_model-theme_custom_style", + fig = plot(p2, style = my_custom_theme) + ) +}) + + +# Test 4: Theme attribute should be stored and retrieved correctly +# ----------------------------------------------------------------------------- +# PROBLEM: The theme attribute is stored by performance::check_model() but may not be +# properly read by see package's plot method. +test_that("theme attribute is stored and used correctly", { + m <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) + + # Test with function + p1 <- performance::check_model(m, theme = ggplot2::theme_dark()) + + # Theme should be stored as attribute + expect_true(!is.null(attr(p1, "theme"))) + + # Attribute should contain the theme + theme_attr <- attr(p1, "theme") + expect_s3_class(theme_attr, "theme") + + # Theme should be applied when plotting + expect_doppelganger_with_seed( + title = "check_model-theme_attr-2", + fig = plot(p1) + ) + + # Test with string + p2 <- performance::check_model(m, theme = "ggplot2::theme_minimal") + expect_true(!is.null(attr(p2, "theme"))) + expect_identical(attr(p2, "theme"), "ggplot2::theme_minimal") + + expect_doppelganger_with_seed( + title = "check_model-theme_attr-3", + fig = plot(p2) + ) +}) + + +# Test 5: Default theme should work when no theme specified +# ----------------------------------------------------------------------------- +# Tests that performance::check_model works correctly when no theme argument is provided, +# ensuring it falls back to the default theme. +test_that("performance::check_model works without theme argument (default behavior)", { + m <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) + + # Should work with default theme + p <- performance::check_model(m) + expect_doppelganger_with_seed( + title = "check_model-without_theme", + fig = plot(p) + ) + + # Default theme should be stored + p <- performance::check_model(m) + expect_true(!is.null(attr(p, "theme"))) +}) + + +# Test 6: style argument in plot() should override theme from performance::check_model() +# ----------------------------------------------------------------------------- +# This tests that the plot method's style parameter can override the theme +# set during performance::check_model() call. +test_that("plot style argument overrides performance::check_model theme", { + m <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) + + # Create with one theme + p <- performance::check_model(m, theme = ggplot2::theme_dark()) + + # Plot with different theme - should work + expect_doppelganger_with_seed( + title = "check_model-different_theme-1", + fig = plot(p, style = ggplot2::theme_minimal()) + ) + expect_doppelganger_with_seed( + title = "check_model-different_theme-2", + fig = plot(p, style = ggplot2::theme_bw()) + ) +}) From d22a3e86a552e60df087386c52012153c7f65510 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 29 Jun 2026 09:39:00 +0200 Subject: [PATCH 2/5] update test and snaps --- .../check-model-different-theme-1.svg | 268 ++++----- .../check-model-different-theme-2.svg | 322 +++++----- .../check-model-theme-attr.svg | 163 ++--- .../check-model-theme-custom-style.svg | 569 ------------------ tests/testthat/test-check_model_theme.R | 17 +- 5 files changed, 354 insertions(+), 985 deletions(-) delete mode 100644 tests/testthat/_snaps/check_model_theme/check-model-theme-custom-style.svg diff --git a/tests/testthat/_snaps/check_model_theme/check-model-different-theme-1.svg b/tests/testthat/_snaps/check_model_theme/check-model-different-theme-1.svg index 1bef42530..275aee63a 100644 --- a/tests/testthat/_snaps/check_model_theme/check-model-different-theme-1.svg +++ b/tests/testthat/_snaps/check_model_theme/check-model-different-theme-1.svg @@ -35,7 +35,7 @@ - + @@ -45,7 +45,7 @@ - + @@ -55,7 +55,7 @@ - + @@ -65,7 +65,7 @@ - + @@ -75,7 +75,7 @@ - + @@ -85,7 +85,7 @@ - + @@ -95,23 +95,22 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -170,23 +169,12 @@ 0.04 0.06 0.08 - - - - - - - - 10 20 30 mpg Density - - - Observed data Model-predicted data @@ -199,23 +187,22 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -259,14 +246,6 @@ 0 3 6 - - - - - - - - 10 15 20 @@ -282,23 +261,22 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -341,14 +319,6 @@ 0.8 1.2 1.6 - - - - - - - - 10 15 20 @@ -365,24 +335,23 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -434,15 +403,6 @@ 0 4 8 - - - - - - - - - 0.0 0.1 0.2 @@ -462,20 +422,19 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -496,26 +455,14 @@ 3 5 10 - - - - - - - - - cyl disp gear wt Variance Inflation Factor (VIF, log-scaled) - - - Low (< 5) @@ -529,25 +476,24 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -591,16 +537,6 @@ 0 1 2 - - - - - - - - - - -2 -1 0 diff --git a/tests/testthat/_snaps/check_model_theme/check-model-different-theme-2.svg b/tests/testthat/_snaps/check_model_theme/check-model-different-theme-2.svg index 5d098d0ac..62dc742b8 100644 --- a/tests/testthat/_snaps/check_model_theme/check-model-different-theme-2.svg +++ b/tests/testthat/_snaps/check_model_theme/check-model-different-theme-2.svg @@ -95,23 +95,23 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -163,6 +163,7 @@ + 0.00 @@ -170,23 +171,23 @@ 0.04 0.06 0.08 - - - - - - - - + + + + + + + + 10 20 30 mpg Density - + - + Observed data Model-predicted data @@ -199,23 +200,23 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -253,20 +254,21 @@ + -3 0 3 6 - - - - - - - - + + + + + + + + 10 15 20 @@ -282,23 +284,23 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -335,20 +337,21 @@ + 0.4 0.8 1.2 1.6 - - - - - - - - + + + + + + + + 10 15 20 @@ -365,24 +368,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -427,6 +430,7 @@ 0.9 0.9 + -8 @@ -434,15 +438,15 @@ 0 4 8 - - - - - - - - - + + + + + + + + + 0.0 0.1 0.2 @@ -462,20 +466,20 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -489,6 +493,7 @@ + 1 @@ -496,15 +501,15 @@ 3 5 10 - - - - - - - - - + + + + + + + + + cyl disp gear @@ -512,10 +517,10 @@ Variance Inflation Factor (VIF, log-scaled) - + - + Low (< 5) @@ -529,25 +534,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -584,6 +589,7 @@ + -2 @@ -591,16 +597,16 @@ 0 1 2 - - - - - - - - - - + + + + + + + + + + -2 -1 0 diff --git a/tests/testthat/_snaps/check_model_theme/check-model-theme-attr.svg b/tests/testthat/_snaps/check_model_theme/check-model-theme-attr.svg index e33232261..a20f5cb1b 100644 --- a/tests/testthat/_snaps/check_model_theme/check-model-theme-attr.svg +++ b/tests/testthat/_snaps/check_model_theme/check-model-theme-attr.svg @@ -96,88 +96,91 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -0.00 -0.02 -0.04 -0.06 - - - - - - - -10 -20 -30 +0.00 +0.02 +0.04 +0.06 +0.08 + + + + + + + + +10 +20 +30 mpg Density diff --git a/tests/testthat/_snaps/check_model_theme/check-model-theme-custom-style.svg b/tests/testthat/_snaps/check_model_theme/check-model-theme-custom-style.svg deleted file mode 100644 index 6b15d0118..000000000 --- a/tests/testthat/_snaps/check_model_theme/check-model-theme-custom-style.svg +++ /dev/null @@ -1,569 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -0.00 -0.02 -0.04 -0.06 - -10 -20 -30 -mpg -Density - - - -Observed data -Model-predicted data -Model-predicted lines should resemble observed data line -Posterior Predictive Check - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --3 -0 -3 -6 - -10 -15 -20 -25 -Fitted values -Residuals -Reference line should be flat and horizontal -Linearity - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -0.4 -0.8 -1.2 -1.6 - -10 -15 -20 -25 -Fitted values - -|Std. residuals| -Reference line should be flat and horizontal -Homogeneity of Variance - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -21 -17 -20 -18 -25 - - -0.9 -0.9 - - - --8 --4 -0 -4 -8 - -0.0 -0.1 -0.2 -0.3 -Leverage ( -h -i -i -) -Std. Residuals -Points should be inside the contour lines -Influential Observations - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -1 -2 -3 -5 -10 - -cyl -disp -gear -wt -Variance Inflation -Factor (VIF, log-scaled) - - - - - -Low (< 5) -Moderate (< 10) -High collinearity (VIF) may inflate parameter uncertainty -Collinearity - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --2 --1 -0 -1 -2 - --2 --1 -0 -1 -2 -Standard Normal Distribution Quantiles -Sample Quantile Deviations -Dots should fall along the line -Normality of Residuals -check_model-theme_custom_style - - diff --git a/tests/testthat/test-check_model_theme.R b/tests/testthat/test-check_model_theme.R index 726dcee57..604594f2e 100644 --- a/tests/testthat/test-check_model_theme.R +++ b/tests/testthat/test-check_model_theme.R @@ -114,13 +114,6 @@ test_that("performance::check_model accepts custom theme functions from user env title = "check_model-theme_custom", fig = plot(p1) ) - - # Also test passing custom theme to plot method's style argument - p2 <- performance::check_model(m) - expect_doppelganger_with_seed( - title = "check_model-theme_custom_style", - fig = plot(p2, style = my_custom_theme) - ) }) @@ -179,11 +172,11 @@ test_that("performance::check_model works without theme argument (default behavi }) -# Test 6: style argument in plot() should override theme from performance::check_model() +# Test 6: theme argument in plot() should override theme from performance::check_model() # ----------------------------------------------------------------------------- -# This tests that the plot method's style parameter can override the theme +# This tests that the plot method's theme parameter can override the theme # set during performance::check_model() call. -test_that("plot style argument overrides performance::check_model theme", { +test_that("plot theme argument overrides performance::check_model theme", { m <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) # Create with one theme @@ -192,10 +185,10 @@ test_that("plot style argument overrides performance::check_model theme", { # Plot with different theme - should work expect_doppelganger_with_seed( title = "check_model-different_theme-1", - fig = plot(p, style = ggplot2::theme_minimal()) + fig = plot(p, theme = ggplot2::theme_minimal()) ) expect_doppelganger_with_seed( title = "check_model-different_theme-2", - fig = plot(p, style = ggplot2::theme_bw()) + fig = plot(p, theme = ggplot2::theme_bw()) ) }) From 81c7795ef79747b7cff29b47ea8fc21bb600ba71 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 29 Jun 2026 09:48:46 +0200 Subject: [PATCH 3/5] update tests --- tests/testthat/test-plot.check_normality.R | 2 + tests/testthat/test-plot.check_outliers.R | 2 + tests/testthat/test-plot.compare_parameters.R | 2 + tests/testthat/test-plot.effectsize_table.R | 1 + tests/testthat/test-plot.n_factors.R | 1 + tests/testthat/test-plot.p_direction.R | 2 + tests/testthat/test-plot.p_significance.R | 6 ++- tests/testthat/test-plot.parameters_model.R | 6 ++- .../testthat/test-plot.performance_pp_check.R | 2 + tests/testthat/test-plot.performance_roc.R | 1 + .../testthat/test-plot.simulate_parameters.R | 2 +- tests/testthat/test-scale_color_colorhex_c.R | 1 + tests/testthat/test-vdiffr_bayestestr_plots.R | 1 + tests/testthat/test-vdiffr_check_model.R | 39 +------------------ .../test-vdiffr_check_overdispersion.R | 5 ++- .../testthat/test-vdiffr_check_predictions.R | 5 +-- tests/testthat/test-vdiffr_check_priors.R | 1 + tests/testthat/test-vdiffr_geoms_coords.R | 2 + tests/testthat/test-vdiffr_means_by_group.R | 3 ++ tests/testthat/test-vdiffr_scale_color.R | 2 + 20 files changed, 39 insertions(+), 47 deletions(-) diff --git a/tests/testthat/test-plot.check_normality.R b/tests/testthat/test-plot.check_normality.R index cd14a9979..968a05620 100644 --- a/tests/testthat/test-plot.check_normality.R +++ b/tests/testthat/test-plot.check_normality.R @@ -1,3 +1,5 @@ +skip_if_not_installed("vdiffr") + test_that("`plot.see_check_normality()` works", { skip_if_not_installed("lme4") skip_if_not_installed("qqplotr") diff --git a/tests/testthat/test-plot.check_outliers.R b/tests/testthat/test-plot.check_outliers.R index f1c286a47..d365dd32e 100644 --- a/tests/testthat/test-plot.check_outliers.R +++ b/tests/testthat/test-plot.check_outliers.R @@ -1,3 +1,5 @@ +skip_if_not_installed("vdiffr") + test_that("`plot.see_check_outliers()` works", { mt1 <- mtcars[, c(1, 3, 4)] mt2 <- rbind( diff --git a/tests/testthat/test-plot.compare_parameters.R b/tests/testthat/test-plot.compare_parameters.R index 4819df434..4576d600b 100644 --- a/tests/testthat/test-plot.compare_parameters.R +++ b/tests/testthat/test-plot.compare_parameters.R @@ -2,6 +2,8 @@ test_that("`plot()` for compare_parameters", { skip_if_not_installed("glmmTMB") skip_if_not_installed("lme4") skip_if_not_installed("parameters") + skip_if_not_installed("vdiffr") + gdat <- readRDS(system.file( "vignette_data", "gophertortoise.rds", diff --git a/tests/testthat/test-plot.effectsize_table.R b/tests/testthat/test-plot.effectsize_table.R index bbb6b490c..5747ed034 100644 --- a/tests/testthat/test-plot.effectsize_table.R +++ b/tests/testthat/test-plot.effectsize_table.R @@ -1,4 +1,5 @@ test_that("`plot.see_effectsize_table()` works", { + skip_if_not_installed("vdiffr") m <- aov(mpg ~ factor(am) * factor(cyl), data = mtcars) result <- effectsize::eta_squared(m) set.seed(123) diff --git a/tests/testthat/test-plot.n_factors.R b/tests/testthat/test-plot.n_factors.R index 529ed0c11..9b2fcd403 100644 --- a/tests/testthat/test-plot.n_factors.R +++ b/tests/testthat/test-plot.n_factors.R @@ -1,5 +1,6 @@ test_that("`plot.see_n_factors()` works", { skip_if_not_installed("nFactors") + skip_if_not_installed("vdiffr") result <- parameters::n_factors(datasets::mtcars, type = "PCA") diff --git a/tests/testthat/test-plot.p_direction.R b/tests/testthat/test-plot.p_direction.R index 22a997f46..68e5db3af 100644 --- a/tests/testthat/test-plot.p_direction.R +++ b/tests/testthat/test-plot.p_direction.R @@ -1,3 +1,5 @@ +skip_if_not_installed("vdiffr") + test_that("`plot.see_p_direction()` works", { skip_if_not_installed("rstanarm") skip_if_not_installed("ggridges") diff --git a/tests/testthat/test-plot.p_significance.R b/tests/testthat/test-plot.p_significance.R index 3fd485f78..e7446f8fe 100644 --- a/tests/testthat/test-plot.p_significance.R +++ b/tests/testthat/test-plot.p_significance.R @@ -1,3 +1,5 @@ +skip_if_not_installed("vdiffr") + test_that("`plot.see_p_significance()` works", { skip_if_not_installed("rstanarm") skip_if_not_installed("ggridges") @@ -9,8 +11,8 @@ test_that("`plot.see_p_significance()` works", { }) skip_on_cran() -skip_if_not_installed("bayestestR", minimum_version = "0.14.1") -skip_if_not_installed("parameters", minimum_version = "0.22.3") +skip_if_not_installed("bayestestR") +skip_if_not_installed("parameters") test_that("`plot.see_p_significance works for two thresholds", { skip_if_not_installed("ggridges") diff --git a/tests/testthat/test-plot.parameters_model.R b/tests/testthat/test-plot.parameters_model.R index a3784f628..17d4ba9bf 100644 --- a/tests/testthat/test-plot.parameters_model.R +++ b/tests/testthat/test-plot.parameters_model.R @@ -1,3 +1,5 @@ +skip_if_not_installed("vdiffr") + test_that("`plot.see_parameters_model()` works", { m <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) result <- parameters::model_parameters(m) @@ -20,11 +22,11 @@ test_that("`plot.see_parameters_model()` sort parameter works for fixed effects" # Test sort = TRUE (should be same as ascending) p1 <- plot(result, sort = TRUE) expect_s3_class(p1, "gg") - + # Test sort = "ascending" p2 <- plot(result, sort = "ascending") expect_s3_class(p2, "gg") - + # Test sort = "descending" p3 <- plot(result, sort = "descending") expect_s3_class(p3, "gg") diff --git a/tests/testthat/test-plot.performance_pp_check.R b/tests/testthat/test-plot.performance_pp_check.R index 0fd19703e..c98258ba6 100644 --- a/tests/testthat/test-plot.performance_pp_check.R +++ b/tests/testthat/test-plot.performance_pp_check.R @@ -1,3 +1,5 @@ +skip_if_not_installed("vdiffr") + test_that("`print.see_performance_pp_check()` works", { set.seed(123) model <- lm(Sepal.Length ~ Species * Petal.Width + Petal.Length, data = iris) diff --git a/tests/testthat/test-plot.performance_roc.R b/tests/testthat/test-plot.performance_roc.R index 3451c4781..dab3d4e52 100644 --- a/tests/testthat/test-plot.performance_roc.R +++ b/tests/testthat/test-plot.performance_roc.R @@ -1,4 +1,5 @@ test_that("`plot.see_performance_roc()` works", { + skip_if_not_installed("vdiffr") set.seed(123) iris$y <- rbinom(nrow(iris), size = 1, 0.3) folds <- sample(nrow(iris), size = nrow(iris) / 8, replace = FALSE) diff --git a/tests/testthat/test-plot.simulate_parameters.R b/tests/testthat/test-plot.simulate_parameters.R index 320ec7f3f..657ba533d 100644 --- a/tests/testthat/test-plot.simulate_parameters.R +++ b/tests/testthat/test-plot.simulate_parameters.R @@ -4,7 +4,7 @@ skip_on_cran() skip_if_offline() skip_if_not_installed("mclogit") skip_if_not_installed("parameters") - +skip_if_not_installed("vdiffr") test_that("`plot()` for simulate_parameters", { pict <- base::readRDS(url("https://slcladal.github.io/data/pict.rda", "rb")) diff --git a/tests/testthat/test-scale_color_colorhex_c.R b/tests/testthat/test-scale_color_colorhex_c.R index 81629f7e3..d96021648 100644 --- a/tests/testthat/test-scale_color_colorhex_c.R +++ b/tests/testthat/test-scale_color_colorhex_c.R @@ -1,4 +1,5 @@ test_that("scale_fill_colorhex works as expected", { + skip_if_not_installed("vdiffr") set.seed(123) vdiffr::expect_doppelganger( title = "scale_fill_colorhex_d works", diff --git a/tests/testthat/test-vdiffr_bayestestr_plots.R b/tests/testthat/test-vdiffr_bayestestr_plots.R index cbe5501de..3df9a5e4a 100644 --- a/tests/testthat/test-vdiffr_bayestestr_plots.R +++ b/tests/testthat/test-vdiffr_bayestestr_plots.R @@ -1,5 +1,6 @@ test_that("bayestestR package plots rendered correctly", { # plot.see_bayesfactor_models() -------------------- + skip_if_not_installed("vdiffr") lm0 <- stats::lm(qsec ~ 1, data = mtcars) lm1 <- stats::lm(qsec ~ drat, data = mtcars) diff --git a/tests/testthat/test-vdiffr_check_model.R b/tests/testthat/test-vdiffr_check_model.R index 55831119d..6612bff91 100644 --- a/tests/testthat/test-vdiffr_check_model.R +++ b/tests/testthat/test-vdiffr_check_model.R @@ -1,4 +1,6 @@ skip_on_cran() +skip_if_not_installed("vdiffr") +skip_if_not_installed("performance") # Snapshot tests for check_model() plots # These tests verify that diagnostic plots render consistently across versions. @@ -11,10 +13,6 @@ expect_doppelganger_with_seed <- function(title, fig, seed = 123) { } test_that("plot.see_check_model() renders correctly", { - skip_if_not_installed("performance") - skip_if_not_installed("see") - skip_on_cran() - set.seed(123) model <- lm(mpg ~ wt + hp + cyl, data = mtcars) @@ -51,10 +49,6 @@ test_that("plot.see_check_model() renders correctly", { test_that("plot.see_check_model() works with themes", { - skip_if_not_installed("performance") - skip_if_not_installed("see") - skip_on_cran() - set.seed(123) data(mtcars) model <- lm(mpg ~ wt + hp, data = mtcars) @@ -82,10 +76,6 @@ test_that("plot.see_check_model() works with themes", { test_that("plot.see_check_model() works with custom colors", { - skip_if_not_installed("performance") - skip_if_not_installed("see") - skip_on_cran() - set.seed(123) model <- lm(mpg ~ wt + hp, data = mtcars) @@ -101,10 +91,6 @@ test_that("plot.see_check_model() works with custom colors", { test_that("plot.see_check_normality() renders correctly", { - skip_if_not_installed("performance") - skip_if_not_installed("see") - skip_on_cran() - set.seed(123) model <- lm(mpg ~ wt + hp + cyl, data = mtcars) norm_result <- performance::check_normality(model) @@ -122,10 +108,6 @@ test_that("plot.see_check_normality() renders correctly", { test_that("plot.see_check_homogeneity() renders correctly", { - skip_if_not_installed("performance") - skip_if_not_installed("see") - skip_on_cran() - set.seed(123) model <- lm(mpg ~ wt, data = mtcars) @@ -145,10 +127,6 @@ test_that("plot.see_check_homogeneity() renders correctly", { test_that("plot.see_check_outliers() renders correctly", { - skip_if_not_installed("performance") - skip_if_not_installed("see") - skip_on_cran() - set.seed(123) model <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) @@ -168,10 +146,6 @@ test_that("plot.see_check_outliers() renders correctly", { test_that("plot.see_check_model() handles large datasets efficiently", { - skip_if_not_installed("performance") - skip_if_not_installed("see") - skip_on_cran() - # Test that sampling produces consistent plots with larger datasets set.seed(123) large_data <- data.frame( @@ -196,10 +170,6 @@ test_that("plot.see_check_model() handles large datasets efficiently", { test_that("plot.see_check_model() works with show_dots parameter", { - skip_if_not_installed("performance") - skip_if_not_installed("see") - skip_on_cran() - set.seed(123) model <- lm(mpg ~ wt + hp, data = mtcars) @@ -226,10 +196,6 @@ test_that("plot.see_check_model() works with show_dots parameter", { test_that("plot outliers skips smooth for low N", { - skip_if_not_installed("performance") - skip_if_not_installed("see") - skip_on_cran() - # fmt: skip sdata <- data.frame( TrtLin = factor(rep( @@ -265,7 +231,6 @@ test_that("plot outliers skips smooth for low N", { test_that("ppc_range works", { skip_if_not_installed("MASS") - skip_if_not_installed("performance") set.seed(3) mu <- rpois(500, lambda = 3) x <- pmax(ceiling(rnorm(500, mu, mu * 3)), 0) diff --git a/tests/testthat/test-vdiffr_check_overdispersion.R b/tests/testthat/test-vdiffr_check_overdispersion.R index 3ce04c22e..1c6c87c35 100644 --- a/tests/testthat/test-vdiffr_check_overdispersion.R +++ b/tests/testthat/test-vdiffr_check_overdispersion.R @@ -1,4 +1,5 @@ skip_on_cran() +skip_if_not_installed("vdiffr") # Snapshot tests for check_model() plots # These tests verify that diagnostic plots render consistently across versions. @@ -11,9 +12,9 @@ expect_doppelganger_with_seed <- function(title, fig, seed = 123) { } test_that("plot.see_check_model() renders correctly", { - skip_if_not_installed("performance", minimum_version = "0.17.0.2") - skip_if_not_installed("see") + skip_if_not_installed("performance") skip_if_not_installed("DHARMa") + skip_if_not_installed("glmmTMB") set.seed(123) diff --git a/tests/testthat/test-vdiffr_check_predictions.R b/tests/testthat/test-vdiffr_check_predictions.R index 17aaaf4f9..28d713d4f 100644 --- a/tests/testthat/test-vdiffr_check_predictions.R +++ b/tests/testthat/test-vdiffr_check_predictions.R @@ -1,4 +1,5 @@ skip_on_cran() +skip_if_not_installed("vdiffr") # Snapshot tests for check_model() plots # These tests verify that diagnostic plots render consistently across versions. @@ -12,8 +13,6 @@ expect_doppelganger_with_seed <- function(title, fig, seed = 123) { test_that("plot.see_check_predictions() renders correctly", { skip_if_not_installed("performance") - skip_if_not_installed("see") - skip_on_cran() data(mtcars) model <- lm(mpg ~ disp, data = mtcars) @@ -32,7 +31,7 @@ test_that("plot.see_check_predictions() renders correctly", { test_that("check_predicions - type and x_limits arguments work", { skip_if_not_installed("MASS") - skip_if_not_installed("performance", minimum_version = "0.17.0.3") + skip_if_not_installed("performance") set.seed(3) mu <- rpois(500, lambda = 3) x <- pmax(ceiling(rnorm(500, mu, mu * 3)), 0) diff --git a/tests/testthat/test-vdiffr_check_priors.R b/tests/testthat/test-vdiffr_check_priors.R index 5d7091f58..284952d83 100644 --- a/tests/testthat/test-vdiffr_check_priors.R +++ b/tests/testthat/test-vdiffr_check_priors.R @@ -1,4 +1,5 @@ skip_on_cran() +skip_if_not_installed("vdiffr") # Helper function for reproducible vdiffr tests expect_doppelganger_with_seed <- function(title, fig, seed = 123) { diff --git a/tests/testthat/test-vdiffr_geoms_coords.R b/tests/testthat/test-vdiffr_geoms_coords.R index d7cabfa1e..11a5e90f4 100644 --- a/tests/testthat/test-vdiffr_geoms_coords.R +++ b/tests/testthat/test-vdiffr_geoms_coords.R @@ -1,3 +1,5 @@ +skip_if_not_installed("vdiffr") + test_that("geom and coord functions work correctly", { skip_if_not_installed("ggplot2") # coord_radar() ------------------ diff --git a/tests/testthat/test-vdiffr_means_by_group.R b/tests/testthat/test-vdiffr_means_by_group.R index c39410a9c..9da6dfe78 100644 --- a/tests/testthat/test-vdiffr_means_by_group.R +++ b/tests/testthat/test-vdiffr_means_by_group.R @@ -1,3 +1,6 @@ +skip_on_cran() +skip_if_not_installed("vdiffr") + test_that("datawizard means_by_group rendered correctly", { set.seed(123) vdiffr::expect_doppelganger( diff --git a/tests/testthat/test-vdiffr_scale_color.R b/tests/testthat/test-vdiffr_scale_color.R index 38d7a6ccc..239dd0296 100644 --- a/tests/testthat/test-vdiffr_scale_color.R +++ b/tests/testthat/test-vdiffr_scale_color.R @@ -1,3 +1,5 @@ +skip_if_not_installed("vdiffr") + test_that("scale_color_ functions work correctly", { vdiffr::expect_doppelganger( title = "scale_color_bluebrown_d() works", From cb18b5b5ebc1d637aa8b66246aa9ce156d8efd5b Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 29 Jun 2026 09:49:38 +0200 Subject: [PATCH 4/5] test --- tests/testthat/test-check_model_theme.R | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/testthat/test-check_model_theme.R b/tests/testthat/test-check_model_theme.R index 604594f2e..ba034531f 100644 --- a/tests/testthat/test-check_model_theme.R +++ b/tests/testthat/test-check_model_theme.R @@ -1,6 +1,7 @@ skip_on_cran() skip_if_not_installed("performance") skip_if_not_installed("ggplot2") +skip_if_not_installed("vdiffr") expect_doppelganger_with_seed <- function(title, fig, seed = 123) { set.seed(seed) From 8fec1f4b7a083a3554d218c5f5f858a9f90018a4 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 29 Jun 2026 09:51:30 +0200 Subject: [PATCH 5/5] fix URL --- R/scale_color_colorhex.R | 21 ++++++++++----------- man/palette_colorhex.Rd | 15 +++++++-------- man/scale_color_colorhex.Rd | 5 ++--- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/R/scale_color_colorhex.R b/R/scale_color_colorhex.R index 74586a675..cca876576 100644 --- a/R/scale_color_colorhex.R +++ b/R/scale_color_colorhex.R @@ -173,29 +173,28 @@ scale_fill_colorhex_c <- function( # Palette -------------------------------------------------------------------- -#' Color palettes from +#' Color palettes from color-hex.com. #' -#' This function downloads a requested color palette from . +#' This function downloads a requested color palette from color-hex.com. #' This website provides a large number of user-submitted color palettes. #' #' @note -#' The default [Josiah color palette (number 1014416)](https://www.color-hex.com/color-palette/1014416) -#' is available without an internet connection. All other color palettes require -#' an internet connection to download and access. +#' The default Josiah color palette (number 1014416) is available without an +#' internet connection. All other color palettes require an internet connection +#' to download and access. #' -#' @param palette The numeric code for a palette at . -#' For example, `1014416` for the -#' [Josiah color palette (number 1014416)](https://www.color-hex.com/color-palette/1014416). +#' @param palette The numeric code for a palette at color-hex.com. For example, +#' `1014416` for the Josiah color palette (number 1014416). #' @inheritParams palette_flat #' #' @details This function is usually not called directly, but from within -#' [`scale_color_colorhex()`][scale_color_colorhex]. +#' [`scale_color_colorhex()`][scale_color_colorhex]. #' #' @export palette_colorhex <- function(palette = 1014416, reverse = FALSE, ...) { if (!is.numeric(palette) && suppressWarnings(is.na(as.numeric(palette)))) { insight::format_error( - "`palette` must be the numeric code for a color palette at " + "`palette` must be the numeric code for a color palette at color-hex.com" ) } @@ -205,7 +204,7 @@ palette_colorhex <- function(palette = 1014416, reverse = FALSE, ...) { } else { insight::check_if_installed( "curl", - reason = "to retrieve palettes from " + reason = "to retrieve palettes from color-hex.com" ) curl_url <- paste0("https://www.color-hex.com//color-palette/", palette) diff --git a/man/palette_colorhex.Rd b/man/palette_colorhex.Rd index d140b42b9..366422100 100644 --- a/man/palette_colorhex.Rd +++ b/man/palette_colorhex.Rd @@ -2,21 +2,20 @@ % Please edit documentation in R/scale_color_colorhex.R \name{palette_colorhex} \alias{palette_colorhex} -\title{Color palettes from \url{https://www.color-hex.com/}} +\title{Color palettes from color-hex.com.} \usage{ palette_colorhex(palette = 1014416, reverse = FALSE, ...) } \arguments{ -\item{palette}{The numeric code for a palette at \url{https://www.color-hex.com/}. -For example, \code{1014416} for the -\href{https://www.color-hex.com/color-palette/1014416}{Josiah color palette (number 1014416)}.} +\item{palette}{The numeric code for a palette at color-hex.com. For example, +\code{1014416} for the Josiah color palette (number 1014416).} \item{reverse}{Boolean indicating whether the palette should be reversed.} \item{...}{Additional arguments to pass to \code{\link[=colorRampPalette]{colorRampPalette()}}.} } \description{ -This function downloads a requested color palette from \url{https://www.color-hex.com/}. +This function downloads a requested color palette from color-hex.com. This website provides a large number of user-submitted color palettes. } \details{ @@ -24,7 +23,7 @@ This function is usually not called directly, but from within \code{\link[=scale_color_colorhex]{scale_color_colorhex()}}. } \note{ -The default \href{https://www.color-hex.com/color-palette/1014416}{Josiah color palette (number 1014416)} -is available without an internet connection. All other color palettes require -an internet connection to download and access. +The default Josiah color palette (number 1014416) is available without an +internet connection. All other color palettes require an internet connection +to download and access. } diff --git a/man/scale_color_colorhex.Rd b/man/scale_color_colorhex.Rd index 9ee6d5328..2c10aa674 100644 --- a/man/scale_color_colorhex.Rd +++ b/man/scale_color_colorhex.Rd @@ -85,9 +85,8 @@ scale_fill_colorhex_c( ) } \arguments{ -\item{palette}{The numeric code for a palette at \url{https://www.color-hex.com/}. -For example, \code{1014416} for the -\href{https://www.color-hex.com/color-palette/1014416}{Josiah color palette (number 1014416)}.} +\item{palette}{The numeric code for a palette at color-hex.com. For example, +\code{1014416} for the Josiah color palette (number 1014416).} \item{discrete}{Boolean indicating whether color aesthetic is discrete or not.}