scale_x_energy_eV_continuous {ggspectra} | R Documentation |
Energy per photon x-scale
Description
Scale x continuous with defaults suitable for wavelengths expressed as energy per photon [eV] or [J].
Usage
scale_x_energy_eV_continuous(
unit.exponent = 0,
name = w_energy_eV_label(unit.exponent = unit.exponent, label.text = label.text),
breaks = scales::pretty_breaks(n = 7),
labels = SI_pl_format(exponent = unit.exponent),
label.text = axis_labels()[["energy"]],
...
)
scale_x_energy_J_continuous(
unit.exponent = -18,
name = w_energy_J_label(unit.exponent = unit.exponent, label.text = label.text),
breaks = scales::pretty_breaks(n = 7),
labels = SI_pl_format(exponent = unit.exponent),
label.text = axis_labels()[["energy"]],
...
)
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. |
... |
other named arguments passed to |
Details
This scale automates the generation of axis labels when the variable
mapped to the x aesthetic contains numeric values for wavelengths
expressed as energy per photon. This is not how spectral data are
stored in all the packages of the R for Photobiology suite and can be used
in plots built with ggplot2()
with explicit mapping using a
conversion function. If desired, a secondary axis can be added manually as
described in sec_axis
.
Note
This function only alters two default arguments, please, see
documentation for scale_continuous
Examples
ggplot(sun.spct, aes(x = wl2energy(w.length, unit = "joule"), y = s.e.irrad)) +
geom_line() +
scale_x_energy_J_continuous()
ggplot(sun.spct, aes(x = wl2energy(w.length, unit = "joule"), y = s.e.irrad)) +
geom_line() +
scale_x_energy_J_continuous(unit.exponent = -19)
ggplot(sun.spct, aes(x = wl2energy(w.length, unit = "eV"), y = s.e.irrad)) +
geom_line() +
scale_x_energy_eV_continuous()
ggplot(sun.spct, aes(x = wl2energy(w.length, unit = "eV"), y = s.e.irrad)) +
geom_line() +
scale_x_energy_eV_continuous(unit.exponent = -3)