w_length_label: Wave- axis labels

View source: R/axis-utils-wlength.R

w_length_labelR Documentation

Wave- axis labels

Description

Generate wavelength, wavenumber, wave frequency, and energy per photon axis labels in SI units, using SI scale factors. Output can be selected as character, expression (R default devices) or LaTeX (for tikz device).

Usage

w_length_label(
  unit.exponent = -9,
  format = getOption("photobiology.math", default = "R.expression"),
  label.text = axis_labels()[["w.length"]]
)

w_number_label(
  unit.exponent = 0,
  format = getOption("photobiology.math", default = "R.expression"),
  label.text = axis_labels()[["w.number"]]
)

w_frequency_label(
  unit.exponent = 9,
  format = getOption("photobiology.math", default = "R.expression"),
  label.text = axis_labels()[["freq"]]
)

w_energy_eV_label(
  unit.exponent = 0,
  format = getOption("photobiology.math", default = "R.expression"),
  label.text = axis_labels()[["energy"]]
)

w_energy_J_label(
  unit.exponent = -18,
  format = getOption("photobiology.math", default = "R.expression"),
  label.text = axis_labels()[["energy"]]
)

Arguments

unit.exponent

integer The exponent in base 10 of the scale multiplier to use.

format

character string, "R", "R.expresion", "R.character", or "LaTeX".

label.text

character Textual portion of the labels.

Details

By default labels consist in a textual name for the quantity, a symbol separated by a comma and units with scale factor in parenthesis. The textual names are by default in English but this default can be overridden for example with translations to a different language. To change or translate the default texts please see axis_labels_uk. The markup language used for the labels can be selected through a parameter argument, with character strings ready to be parsed into R expressions as default.

Wavelengths are assumed to be expressed in nanometres in the data. The unit.exponent corresponds to that desired for the tick labels with the corresponding axis label automatically set to an SI scale factor if possible, and otherwise shown as a power of 10.

These functions are used internally by x scales; see sec_axis_w_number and scale_x_wl_continuous. The scales and secondary axis functions should be used except when defining new scale functions.

Value

a character string or an R expression.

Examples


w_length_label()
w_length_label("R.expression")
w_length_label("LaTeX")
w_number_label()
w_number_label("R.expression")
w_frequency_label()
w_frequency_label("R.expression")
w_energy_J_label()
w_energy_eV_label()


ggspectra documentation built on Oct. 22, 2023, 1:07 a.m.