Mar and Mgp {DescTools}R Documentation

Set Plot Margins and Distances

Description

Plot margins are normally set by par("mar"). However one is forced to always define all margins, even if just one should be altered. The convenience function Mar() allows to set one single margin (or several) while leaving the others unchanged.

Mgp() does the same for the distances of axis title, labels and line.

Usage

Mar(bottom = NULL, left = NULL, top = NULL, right = NULL, outer = FALSE, 
    reset = FALSE)
Mgp(title = NULL, labels = NULL, line = NULL, reset = FALSE)

Arguments

bottom

the bottom margin, if set to NULL the current value will be maintained.

left

the left margin, if set to NULL the current value will be maintained.

top

the top margin, if set to NULL the current value will be maintained.

right

the right margin, if set to NULL the current value will be maintained.

outer

logical, defining if inner margins (par("mar")) or the outer margins (par("oma")) should be set. Default is FALSE, meaning that the inner margins will be concerned.

reset

if set to TRUE the margins are reset to the defaults (respecting outer). Other arguments are ignored.

title

margin line for the axis title (default 3)

labels

margin line for the axis labels (default 1)

line

margin line for the axis line (default 0)

Details

Running Mar() without any arguments will return the current settings, either par("mar"), when outer is set to FALSE or par("oma") for outer = TRUE.

Author(s)

Andri Signorell <andri@signorell.net>

See Also

par

Examples

# largen the left margin only
Mar(left=10.1)   # or as alternative: Mar(, 10.1)
Mgp(title=6)     # ylab must be placed a little further to the left
barplot(1:7, names=levels(d.pizza$driver), horiz=TRUE, las=1, 
        ylab="driver", col=Pal("Helsana"))

[Package DescTools version 0.99.55 Index]