View source: R/02_data_preparation.R
cond.boxplots | R Documentation |
The cond.boxplots
function draws, within a single panel, conditional boxplots (i.e.
a plot of a continuous Y variable against one or several categorical X(s) variable(s) (factor),
or discretized numeric variable(s)) in order to explore bivariate relationships and
assess heteroscedasticity.
If some of the X variables are quantitative (numeric), they will consequently be transformed into
factors and discretized into a given number of classes, set approximately by the N
parameter. This
factorisation is required because boxplots are not meant to plot two quantitative variables (without
factorisation, the function would plot as many boxplots as there are values in X).
cond.boxplots(
dataset,
Y,
Xs,
outlier,
N = 6,
MAR = c(2.2, 2.1, 0.5, 1.7),
CEX.LAB = 0.9,
FONT.LAB = 2,
BTY = "n",
FG = "gray35",
COL.AXIS = "gray35",
COL.LAB = "gray20",
CEX.PAR = 0.8,
TCL = -0.3,
MGP = c(1.2, 0.4, 0.2),
OMA = c(1, 0, 0, 0),
TYPE = "n",
BORDER = "moccasin",
COL = "gray50",
LTY = 1,
STAPLEWEX = 0,
WHISKLWD = 2,
BOXWEX = 0.5,
BOXLWD = 0.1,
MEDLWD = 2.6,
PCH = 19,
...
)
dataset |
The input |
Y |
The number of the column of |
Xs |
The numbers of the columns to be plotted as Xs (e.g. |
outlier |
Logical ( |
N |
Integer. The number of bins on X. Default is 6. |
MAR |
A numerical vector of the form |
CEX.LAB |
The magnification to be used for x and y labels relative to the current setting
of |
FONT.LAB |
The font to be used for x and y labels. |
BTY |
A character string which determined the type of box which is drawn about plots. If |
FG |
The color to be used for the foreground of plots. This is the default color used for things like axes and boxes around plots (defaults to "gray35"). |
COL.AXIS |
The color to be used for axis annotation. Defaults to "gray35". |
COL.LAB |
The color to be used for x and y labels. Defaults to "gray20". |
CEX.PAR |
A numerical value giving the amount by which plotting text and symbols should be
magnified relative to the default (for |
TCL |
The length of tick marks as a fraction of the height of a line of text. The default value is -0.3. |
MGP |
The margin line (in |
OMA |
A vector of the form |
TYPE |
The type of boxplot to draw. Default is "n". |
BORDER |
An optional vector of colors for the outlines of the boxplots. The values in border are recycled if the length of border is less than the number of plots. Default is "lightcoral". |
COL |
If col is non-null it is assumed to contain colors to be used to colour the bodies of the boxplots. Default is "moccasin". |
LTY |
The line type. Line types can either be specified as an integer (0=blank, 1=solid (default), 2=dashed, 3=dotted, 4=dotdash, 5=longdash, 6=twodash) or as one of the character strings "blank", "solid", "dashed", "dotted", "dotdash", "longdash", or "twodash", where "blank" uses ‘invisible lines’ (i.e., does not draw them). |
STAPLEWEX |
Staple line width expansion, proportional to box width. Default is 0. |
WHISKLWD |
Whisker line width expansion. Default is 2. |
BOXWEX |
A scale factor to be applied to all boxes. When there are only a few groups, the appearance of the plot can be improved by making the boxes narrower. Default is 0.7. |
BOXLWD |
Width of boxplot outer lines. Default is 0.1. |
MEDLWD |
Width of the median line. Default is 2.6. |
PCH |
The type of points to be drawn for outliers. Default is 19. See |
... |
Any other graphical parameter of |
A panel of conditional boxplots.
cond.boxplots(dataset = iris, Y = 1, Xs = 2:5, outlier = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.