Learn R Programming

ggspectra (version 0.3.13)

scale_x_wl_continuous: Wavelength x-scale

Description

Scale x continuous with defaults suitable for wavelengths in nanometres.

Usage

scale_x_wl_continuous(
  unit.exponent = -9,
  name = w_length_label(unit.exponent = unit.exponent, label.text = label.text,
    axis.symbols = axis.symbols),
  breaks = scales::pretty_breaks(n = 7),
  labels = SI_pl_format(exponent = unit.exponent + 9),
  label.text = axis_labels()[["w.length"]],
  axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE),
  ...
)

Arguments

unit.exponent

integer

name

The name of the scale, used for the axis-label.

breaks

The positions of ticks or a function to generate them.

labels

The tick labels or a function to generate them from the tick positions.

label.text

character Textual portion of the labels.

axis.symbols

logical If TRUE symbols of the quantities are added to the name. Supported only by format = "R.expression".

...

other named arguments passed to scale_y_continuous

Details

This scale automates the generation of axis labels when the variable mapped to the x aesthetic contains numeric values for wavelengths expressed in nanometres. This is how spectral data are stored in all the packages of the R for Photobiology suite, inlcuding the the expected data by the autoplot() methods defined in 'ggspectra'.

Examples

Run this code

ggplot(sun.spct) +
  geom_line() +
  scale_x_wl_continuous()

ggplot(sun.spct) +
  geom_line() +
  scale_x_wl_continuous(unit.exponent = -6)

ggplot(sun.spct) +
  geom_line() +
  scale_x_wl_continuous(label.text = "Longitud de onda,")

autoplot(sun.spct) +
  scale_x_wl_continuous(label.text = "Longitud de onda,",
                        unit.exponent = -6)

Run the code above in your browser using DataLab