uni.dotplots: Univariate Cleveland dotplots

View source: R/02_data_preparation.R

uni.dotplotsR Documentation

Univariate Cleveland dotplots

Description

The uni.dotplots function draws, within a single panel, an independent Cleveland dotplot (i.e. plotting value against rank) 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.

Usage

uni.dotplots(
  dataset,
  MAR = c(3, 2, 0.5, 1.5),
  CEX.LAB = 1.2,
  FONT.LAB = 2,
  BTY = "n",
  FG = "gray35",
  COL.AXIS = "gray35",
  COL.LAB = "gray20",
  CEX.PAR = 0.6,
  TCL = -0.3,
  MGP = c(1.7, 0.6, 0.1),
  OMA = c(1, 0, 1, 0),
  LAB = c(5, 10, 7),
  COL.PCH = "lightcoral",
  PCH = 19,
  COL.GRID = "lavender",
  NX = 5,
  NY = 9,
  LTY = 6,
  ...
)

Arguments

dataset

The input dataset containing all variables to be plotted (must be a data.frame with at least 2 variables). It may contain all kinds of columns, the uni.dotplots function will automatically detect and plot numeric variables (columns).

MAR

A numerical vector of the form c(bottom, left, top, right) which gives the number of lines of margin to be specified on the four sides of the plot. The default is c(0.5,4.1,1.1,1.5).

CEX.LAB

The magnification to be used for x and y labels relative to the current setting of CEX.PAR.

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 BTY is one of "o", "l", "7", "c", "u", or "]" the resulting box resembles the corresponding upper case letter. A value of "n" suppresses the box (the default).

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 par, the panel manager). This starts as 1 when a device is opened, and is reset when the layout is changed, e.g. by setting mfrow. Defaults to 0.8.

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 mex units) for the axis title, axis labels and axis line. Note that mgp[1] affects title whereas mgp[2:3] affect axis. The default is c(2.4, 0.6, 0).

OMA

A vector of the form c(bottom, left, top, right) giving the size of the outer margins in lines of text.

LAB

A numerical vector of the form c(x, y, len) which modifies the default way that axes are annotated. The values of x and y give the (approximate) number of tickmarks on the x and y axes and len specifies the label length. The default is c(5, 5, 7). Note that this only affects the way the parameters xaxp and yaxp are set when the user coordinate system is set up, and is not consulted when axes are drawn. len is unimplemented in R.

COL.PCH

The color to be used for points. Default is "lightcoral".

PCH

The type of points to be drawn. Default is 19. See points for possible values and their interpretation.

COL.GRID

The color of the background grid. Default is "lavender".

NX

The number of lines for the grid in x. Default value is 5.

NY

The number of lines for the grid in Y. Default value is 9.

LTY

The type of lines to be drawn in the background grid. Default value is 6.

...

Any other parameter that can be incorporated in plot.

Details

The uni.dotplots function only modifies the graphical parameters of the plot function in the graphics package to match some predefined preferences. Therefore, default values of uni.dotplots create nice looking dotplots but retain some aspects of the original plot function. These aspects can however be changed as in plot.
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.

Value

A panel of univariate dotplots.

Note

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 plot function should be called with their normal case writing (e.g. sub = "My subtitle")!

Examples

data("mtcars")
uni.dotplots(dataset = mtcars, COL.GRID = "lightblue", LTY = 1, NX = 10, NY = 20)

mrelnoob/jk.dusz.tarping documentation built on July 31, 2023, 9:19 a.m.