LabelAxis | R Documentation |
Obtain an axis label involving common math expressions for label and units.
LabelAxis(
label = "oxy",
prefix = "",
suffix = "",
unit = "permil",
time.unit = NULL,
unit.type = "standard",
bracket.type = "round",
dot = FALSE,
font = 1
)
label |
character string with the name of the quantity referred to on the axis; see details for the available keywords to automatically produce common math expressions of axis names. |
prefix |
optional character string preceding the axis |
suffix |
optional character string following the axis |
unit |
character string with an abbreviation of the physical unit of
the quantity displayed on the axis; see details for the available keywords
to automatically produce common math expressions of units. The unit is
placed after the |
time.unit |
character string with an abbreviation of the physical unit
of time needed to determine the unit of power spectral density when
|
unit.type |
character; the type of axis for determining the format
of the axis unit. Default |
bracket.type |
the type of bracket to use for surrounding the
|
dot |
logical; shall a multiplication sign (as a dot) be placed between
the units for axis types |
font |
an integer which specifies which font to use for the label text;
see |
This function provides some keywords to automatically format common math expressions for axis labels and units.
For label
:
notation for oxygen isotopic composition; i.e., a greek delta followed by a roman "O" prefixed by superscript "18".
notation for hydrogen isotopic composition; i.e., a greek delta followed by a roman "H" prefixed by superscript "2".
alternative notation for hydrogen isotopic composition: greek delta followed by a roman "D".
For unit
:
the percent sign.
the per mille sign.
degree Celsius.
a language object to be passed on to xlab
, ylab
etc. parameter settings in plot calls, or directly to text
or
mtext
calls.
Thomas Münch
plot(1 : 15, type = "n", xlab = "", ylab = "")
# preformatted isotope labels and units using the keywords
text(1, 15, adj = 0, labels = LabelAxis(label = "oxy"))
text(1, 14, adj = 0, labels = LabelAxis(label = "dtr"))
# change font setting
# (but note that greek letters and other symbols remain unchanged)
text(1, 13, adj = 0, labels = LabelAxis(label = "dtr.var", font = 2))
# use normal text as label
text(1, 12, adj = 0, labels = LabelAxis(label = "Some other isotope species"))
# use a prefix together with a preformatted label
text(1, 11, adj = 0, labels = LabelAxis(label = "oxy", prefix = "Ice core"))
# use a suffix together with a preformatted label
text(1, 10, adj = 0, labels = LabelAxis(label = "oxy", suffix = "anomaly"))
# use both
text(1, 9, adj = 0, labels = LabelAxis(label = "oxy",
prefix = "Ice core", suffix = "anomaly"))
# temperature unit in degree Celsius
text(1, 8, adj = 0,
labels = LabelAxis(label = "Temperature", unit = "celsius"))
# automatic formatting of unit for a frequency axis
text(1, 7, adj = 0,
labels = LabelAxis(label = "Frequency", unit = "yr",
unit.type = "freq"))
# automatic formatting of unit for a trend axis
text(1, 6, adj = 0,
labels = LabelAxis(label = "Temperature trend", unit = "celsius",
time.unit = "yr", unit.type = "trend"))
# automatic formatting of unit for a power spectral density axis
text(1, 5, adj = 0,
labels = LabelAxis(label = "PSD", unit = "permil",
time.unit = "yr", unit.type = "psd"))
# use a multiplication dot
text(1, 4, adj = 0,
labels = LabelAxis(label = "PSD", unit = "K",
time.unit = "s", unit.type = "psd", dot = TRUE))
# note that for the previous examples two units are mandatory:
## Not run:
LabelAxis(label = "trend", unit = "permil", unit.type = "trend")
LabelAxis(label = "PSD", unit = "permil", unit.type = "psd")
## End(Not run)
# pass preformatted math expression as label (needs to use 'bquote'!)
text(1, 3, adj = 0,
labels = LabelAxis(label = bquote("T"["2m"]), unit = "celsius"))
# use other brackets around units
text(1, 2, adj = 0,
labels = LabelAxis(label = "I like squares", unit = "unit",
bracket.type = "square"))
text(1, 1, adj = 0,
labels = LabelAxis(label = "I like curly hair", unit = "unit",
bracket.type = "curly"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.