nicePairsPlot: Plot a Nice Pairs Plot

View source: R/all_custom_functions.R

nicePairsPlotR Documentation

Plot a Nice Pairs Plot

Description

A selfmade version of a pairs plot (not based on pairs()). The upper panel normally shows scatterplots while the lower panel shows significance tests of the pairwise relations. The diagonal panel shows histograms or barplots depending on the variable type. The significance tests are also adpated depending on variable type. Categorical variables are, if not specified differently, grouped together and indicated with shaded backgrounds in the plots.

Usage

nicePairsPlot(x, catVar = NULL, breaks = "Sturges", density = FALSE,
jitter = FALSE, jitFactor = 1, loess = FALSE, swtchPan = FALSE,
exclude = c("none", "numeric", "factor"), keepOrder = FALSE, facsAtBegin = FALSE,
cex.diag = 2, cex.offdiag = 1, cex.mean = 2, cex.lvls = 1)

Arguments

x

A dataframe or matrix.

catVar

A factor determining the colour of the points in the scatterplots.

breaks

"breaks" option for hist() function of diagonal panel.

density

A logical value indicating whether density lines should be drawn in the histograms in the diagonal panel.

jitter

A logical value indicating whether a jitter factor should be applied to the scatterplots of numerical variables. For categorical variables there is always some amount of jitter applied.

jitFactor

The jittering factor applied (is slightly decreased for categorical variables).

loess

A logical value indicating whether a loess fit should be plotted in the scatterplots of numerical variables.

swtchPan

A logical value indicating whether the upper and lower panels should be switched.

exclude

Can either be the name(s) of variables to exclude, or a general exclusion option. The general exclusion option can be used to exclude all categorical or numerical variables.

keepOrder

A logical value. Normally, categorical variables are grouped together, this argument can be used to retain the original column order.

facsAtBegin

A logical value. Normally, categorical variables are grouped together at the end of the plot, this argument can be used to move them to the beginning.

cex.diag

Size expansion factor for the titles in the diagonal figures.

cex.offdiag

An expansion factor which will be multiplied with the textsizes of the coefficients displayed in the off-diagonal. Can be used to incerease or decrease the size of the displayed coefficients.

cex.mean

An expansion factor to set the size of the indicated mean values in the scatter plots showing relations between a factor and a numeric variable.

cex.lvls

An expansion factor to set the size of the names of the levels in barplots.

Examples

nicePairsPlot(iris, density = TRUE, loess = TRUE)

ryannick28/CustomFunctionsYrotha documentation built on June 1, 2025, 4:02 p.m.