margin: integer value indicating which margin to adjust, using the order by graphics::par("mar"), 1=bottom, 2=left, 3=top, 4=right.
maxFig: numeric fraction less than 1, indicating the maximum size of margin relative to the figure size. Setting margins too large results in an error otherwise.
cex: numeric or NULL, default graphics::par("cex"), used as a convenience with cex * cex.axis passed to graphics::strwidth(). However, graphics::axis() itself should use cex.axis when adjusting axis label font size.
cex.axis: numeric, default graphics::par("cex.axis") to define the axis label font size.
prefix: character string to add whitespace around the axis label in order to add a "buffer" of whitespace.
...: additional parameters are ignored.
Returns
list named "mai" suitable for use in graphics::par()
to adjust margin size using in inches.
Details
This function takes a vector of axis labels, and the margin where they will be used, and adjusts the relevant axis margin to accomodate the label size, up to a maximum fraction of the figure size as defined by maxFig.
Labels are assumed to be perpendicular to the axis, for example argument las=2 when using graphics::text().
Note this function does not render labels in the figure, and therefore does not revert axis margins to their original size. That process should be performed separately.