View source: R/02_data_preparation.R
uni.boxplots | R Documentation |
The uni.boxplots
function draws, within a single panel, an independent boxplot for each
numeric (continuous or discrete) variable in a given dataset. It is particularly useful for data
exploration (e.g. Zuur et al., 2010). For instance, to simultaneously observe the
distributions of all numeric variables or to detect their univariate outliers.
uni.boxplots(
dataset,
MAR = c(0.5, 4.1, 1.1, 1.5),
CEX.LAB = 1,
FONT.LAB = 2,
BTY = "n",
FG = "gray35",
COL.AXIS = "gray35",
COL.LAB = "gray20",
CEX.PAR = 0.8,
TCL = -0.3,
MGP = c(2.4, 0.6, 0),
OMA = c(1, 0, 0, 0),
TYPE = "n",
BORDER = "lightcoral",
COL = "moccasin",
LTY = 1,
STAPLEWEX = 0,
WHISKLWD = 2,
BOXWEX = 0.7,
BOXLWD = 0.1,
MEDLWD = 2.6,
PCH = 19,
...
)
dataset |
The input dataset containing all variables to be plotted. It may contain all kinds of
variables, the |
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 parameter that can be incorporated in |
The uni.boxplots
function only modifies the graphical parameters of the
boxplot
function in the graphics
package to match some predefined
preferences. Therefore, default values of uni.boxplots
create nice looking boxplots but retain
default heuristic aspects of boxplot
(such as the length of whiskers or the plotting of
outliers). These aspects can however be changed as in boxplot
.
On the other hand, panel parameters are internally controlled using par
. However, to avoid unforeseen
conflicts with other internal parameters, it is not possible to tune panel parameters as we would
do with par
. Instead, parametrization is only possible with the given subset of parameters.
A panel of univariate boxplots.
To avoid recursive argument errors, internal arguments should be called using upper case
letters (e.g. CEX.LAB = 0.9) whereas other arguments from the boxplot
function should be called with
their normal case writing (e.g. outline = FALSE)!
data("mtcars")
uni.boxplots(dataset = mtcars)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.