Title: | Extensions to 'ggplot2' for Radiation Spectra |
---|---|
Description: | Additional annotations, stats, geoms and scales for plotting "light" spectra with 'ggplot2', together with specializations of ggplot() and autoplot() methods for spectral data and waveband definitions stored in objects of classes defined in package 'photobiology'. Part of the 'r4photobiology' suite, Aphalo P. J. (2015) <doi:10.19232/uv4pb.2015.1.14>. |
Authors: | Pedro J. Aphalo [aut, cre] , Titta K. Kotilainen [ctb] |
Maintainer: | Pedro J. Aphalo <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.3.14 |
Built: | 2024-11-13 23:16:17 UTC |
Source: | https://github.com/aphalo/ggspectra |
Additional annotations, stats, geoms and scales for plotting "light" spectra with 'ggplot2', together with specializations of ggplot() and autoplot() methods for spectral data and waveband definitions stored in objects of classes defined in package 'photobiology'. Part of the 'r4photobiology' suite, Aphalo P. J. (2015) doi:10.19232/uv4pb.2015.1.14.
Package 'ggspectra' provides a set of layer functions and
autoplot()
methods extending packages 'ggplot2' and 'photobiology'.
The autoplot()
methods specialised for objects of classes defined in
package 'photobiology' facilitate in many respects the plotting of spectral
data. The ggplot()
methods specialised for objects of classes
defined in package 'photobiology' combined with the new layer functions and
scales easy the task of flexibly plotting radiation-related spectra and of
annotating the resulting plots.
These methods, layer functions and scales are
specialized and work only with certain types of data and ways of expressing
physical quantities. Most importantly, all statistics expect the
values mapped to the x
aesthetic to be wavelengths expressed in
nanometres (nm), which is ensured when the data are stored in data objects
of classes defined in package 'photobiology'. The support for scale transforms
is manual and only partial. Flipping is not supported.
Although originally aimed at plots relevant to photobiology, many of the functions in the package are also useful for plotting other UV, VIS and NIR spectra of light emission, transmittance, reflectance, absorptance, and responses.
The available summary quantities are both simple statistical summaries and response-weighted summaries. Simple derived quantities represent summaries of a given range of wavelengths, and can be expressed either in energy or photon based units. Derived biologically effective quantities are used to quantify the effect of radiation on different organisms or processes within organisms. These effects can range from damage to perception of informational light signals. Additional features of spectra may be important and worthwhile annotating in plots. Of these, local maxima (peaks), minima (valleys) and spikes present in spectral data can also be annotated with statistics from 'ggspectra'.
Package 'ggspectra' is useful solely for plotting spectral data as most
functions depend on the x
aesthetic being mapped to a variable containing
wavelength values expressed in nanometres. It works well together with
many other extensions to package 'ggplot2' such as packages 'ggrepel',
'gganimate' and 'cowplot'.
This package is part of a suite of R packages for photobiological calculations described at the [r4photobiology](https://www.r4photobiology.info) web site.
This package makes use of the new features of 'ggplot2' >= 2.0.0 that make writing this kind of extensions easy and is consequently not compatible with earlier versions of 'ggplot2'.
Maintainer: Pedro J. Aphalo [email protected] (ORCID)
Other contributors:
Titta K. Kotilainen (ORCID) [contributor]
Aphalo, Pedro J. (2015) The r4photobiology suite. UV4Plants Bulletin, 2015:1, 21-29. doi:10.19232/uv4pb.2015.1.14.
ggplot2
web site at https://ggplot2.tidyverse.org/ggplot2
source code at https://github.com/tidyverse/ggplot2
Function multiplot
from http://www.cookbook-r.com/
Useful links:
Report bugs at https://github.com/aphalo/ggspectra/issues/
library(photobiologyWavebands) ggplot(sun.spct) + geom_line() + stat_peaks(span = NULL) ggplot(sun.spct, aes(w.length, s.e.irrad)) + geom_line() + stat_peaks(span = 21, geom = "point", colour = "red") + stat_peaks(span = 51, geom = "text", colour = "red", vjust = -0.3, label.fmt = "%3.0f nm") ggplot(polyester.spct, range = UV()) + geom_line() autoplot(sun.spct) autoplot(polyester.spct, UV_bands(), range = UV(), annotations = c("=", "segments", "labels"))
library(photobiologyWavebands) ggplot(sun.spct) + geom_line() + stat_peaks(span = NULL) ggplot(sun.spct, aes(w.length, s.e.irrad)) + geom_line() + stat_peaks(span = 21, geom = "point", colour = "red") + stat_peaks(span = 51, geom = "text", colour = "red", vjust = -0.3, label.fmt = "%3.0f nm") ggplot(polyester.spct, range = UV()) + geom_line() autoplot(sun.spct) autoplot(polyester.spct, UV_bands(), range = UV(), annotations = c("=", "segments", "labels"))
Generate cps axis labels in SI units, using SI scale factors. Output can be selected as character, expression (R default devices) or LaTeX (for tikz device).
A_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), Tfr.type ) A_internal_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) A_total_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) )
A_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), Tfr.type ) A_internal_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) A_total_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) )
unit.exponent |
integer |
format |
character string, "R", "R.expresion", "R.character", or "LaTeX". |
label.text |
character Textual portion of the labels. |
scaled |
logical If |
normalized |
logical ( |
axis.symbols |
logical If |
Tfr.type |
character, either "total" or "internal". |
a character string or an R expression.
Default for label.text
depends on the value passed as argument
to Tfr.type
.
A_label(Tfr.type = "internal") A_label(Tfr.type = "total") A_label(Tfr.type = "total", axis.symbols = FALSE) A_internal_label() A_internal_label(format = "R.expression", axis.symbols = FALSE) A_internal_label(-3) A_internal_label(format = "R.expression") A_internal_label(format = "LaTeX") A_internal_label(-3, format = "LaTeX") A_total_label() A_total_label(format = "R.expression", axis.symbols = FALSE) A_total_label(-3) A_total_label(format = "R.expression") A_total_label(format = "LaTeX") A_total_label(-3, format = "LaTeX")
A_label(Tfr.type = "internal") A_label(Tfr.type = "total") A_label(Tfr.type = "total", axis.symbols = FALSE) A_internal_label() A_internal_label(format = "R.expression", axis.symbols = FALSE) A_internal_label(-3) A_internal_label(format = "R.expression") A_internal_label(format = "LaTeX") A_internal_label(-3, format = "LaTeX") A_total_label() A_total_label(format = "R.expression", axis.symbols = FALSE) A_total_label(-3) A_total_label(format = "R.expression") A_total_label(format = "LaTeX") A_total_label(-3, format = "LaTeX")
Generate cps axis labels in SI units, using SI scale factors. Output can be selected as character, expression (R default devices) or LaTeX (for tikz device).
Afr_label( unit.exponent = ifelse(pc.out, -2, 0), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.Afr"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE) ) Rfr_total_label( unit.exponent = ifelse(pc.out, -2, 0), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE) )
Afr_label( unit.exponent = ifelse(pc.out, -2, 0), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.Afr"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE) ) Rfr_total_label( unit.exponent = ifelse(pc.out, -2, 0), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE) )
unit.exponent |
integer |
format |
character string, "R", "R.expresion", "R.character", or "LaTeX". |
label.text |
character Textual portion of the labels. |
scaled |
logical If |
normalized |
logical ( |
axis.symbols |
logical If |
pc.out |
logical, if TRUE use percent as default instead of fraction of one. |
a character string or an R expression.
Afr_label() Afr_label(format = "R.expression", axis.symbols = FALSE) Afr_label(-2) Afr_label(-3) Afr_label(format = "R.expression") Afr_label(format = "LaTeX") Afr_label(-2, format = "LaTeX") Rfr_total_label() Rfr_total_label(axis.symbols = FALSE) Rfr_total_label(-2) Rfr_total_label(-3) Rfr_total_label(format = "R.expression") Rfr_total_label(format = "LaTeX") Rfr_total_label(-3, format = "LaTeX")
Afr_label() Afr_label(format = "R.expression", axis.symbols = FALSE) Afr_label(-2) Afr_label(-3) Afr_label(format = "R.expression") Afr_label(format = "LaTeX") Afr_label(-2, format = "LaTeX") Rfr_total_label() Rfr_total_label(axis.symbols = FALSE) Rfr_total_label(-2) Rfr_total_label(-3) Rfr_total_label(format = "R.expression") Rfr_total_label(format = "LaTeX") Rfr_total_label(-3, format = "LaTeX")
These methods return a ggplot object with an annotated plot of the spectral
data contained in a calibration_spct
or a calibration_mspct
object.
## S3 method for class 'calibration_spct' autoplot( object, ..., w.band = getOption("photobiology.plot.bands", default = list(UVC(), UVB(), UVA(), PhR())), range = getOption("ggspectra.wlrange", default = NULL), unit.out = "ignored", pc.out = getOption("ggspectra.pc.out", default = FALSE), label.qty = "mean", span = NULL, wls.target = "HM", annotations = NULL, geom = "line", time.format = "", tz = "UTC", norm = NULL, text.size = 2.5, idfactor = NULL, facets = FALSE, plot.data = "as.is", ylim = c(NA, NA), object.label = deparse(substitute(object)), na.rm = TRUE ) ## S3 method for class 'calibration_mspct' autoplot( object, ..., range = getOption("ggspectra.wlrange", default = NULL), unit.out = "ignored", norm = getOption("ggspectra.normalize", default = "skip"), pc.out = getOption("ggspectra.pc.out", default = FALSE), plot.data = "as.is", idfactor = TRUE, facets = FALSE, object.label = deparse(substitute(object)), na.rm = TRUE )
## S3 method for class 'calibration_spct' autoplot( object, ..., w.band = getOption("photobiology.plot.bands", default = list(UVC(), UVB(), UVA(), PhR())), range = getOption("ggspectra.wlrange", default = NULL), unit.out = "ignored", pc.out = getOption("ggspectra.pc.out", default = FALSE), label.qty = "mean", span = NULL, wls.target = "HM", annotations = NULL, geom = "line", time.format = "", tz = "UTC", norm = NULL, text.size = 2.5, idfactor = NULL, facets = FALSE, plot.data = "as.is", ylim = c(NA, NA), object.label = deparse(substitute(object)), na.rm = TRUE ) ## S3 method for class 'calibration_mspct' autoplot( object, ..., range = getOption("ggspectra.wlrange", default = NULL), unit.out = "ignored", norm = getOption("ggspectra.normalize", default = "skip"), pc.out = getOption("ggspectra.pc.out", default = FALSE), plot.data = "as.is", idfactor = TRUE, facets = FALSE, object.label = deparse(substitute(object)), na.rm = TRUE )
object |
a calibration_spct object or a calibration_mspct object. |
... |
in the case of collections of spectra, additional arguments passed to the plot methods for individual spectra, otherwise currently ignored. |
w.band |
a single waveband object or a list of waveband objects. |
range |
an R object on which |
unit.out |
character IGNORED. |
pc.out |
logical, if |
label.qty |
character string giving the type of summary quantity to use
for labels, one of |
span |
a peak is defined as an element in a sequence which is greater than all other elements within a window of width span centred at that element. |
wls.target |
numeric vector indicating the spectral quantity values for
which wavelengths are to be searched and interpolated if need. The
|
annotations |
a character vector. For details please see sections Plot Annotations and Title Annotations. |
geom |
character The name of a ggplot geometry, currently only
|
time.format |
character Format as accepted by
|
tz |
character Time zone to use for title and/or subtitle. |
norm |
numeric Normalization wavelength (nm) or character string
|
text.size |
numeric size of text in the plot decorations. |
idfactor |
character Name of an index column in data holding a
|
facets |
logical or integer Indicating if facets are to be created for
the levels of |
plot.data |
character Data to plot. Default is |
ylim |
numeric y axis limits, |
object.label |
character The name of the object being plotted. |
na.rm |
logical. |
The plot object returned is a ggplot (an object of class
"gg"
) and it can be added to or modified as any other ggplot. The
axis labels are encoded as plotmath expressions as they contain
superscripts and special characters. In 'ggplot2', plotmath expressions do
not obey theme settings related to text fonts, except for size
.
Scale limits are expanded so as to make space for the annotations. If
annotations are disabled, limits are not expanded unless
reserve.space
is passed to parameter annotations
.
The generic of the autoplot
method is defined in
package 'ggplot2'. Package 'ggspectra' defines specializations for the
different classes for storage of spectral data defined in package
photobiology
.
A ggplot
object with a number of layers that depends on the
data and annotations.
The recognized annotation names are: "summaries"
, "peaks"
,
"peak.labels"
, "valleys"
, "valley.labels"
,
"wls"
, "wls.labels"
, "colour.guide"
,
"color.guide"
, "boxes"
, "segments"
, "labels"
.
In addition, "+"
is interpreted as a request to add to the already
present default annotations, "-"
as request to remove annotations
and "="
or missing"+"
and "-"
as a request to reset
annotations to those requested. If used, "+"
, "-"
or
"="
must be the first member of a character vector, and followed by
one or more of the names given above. To simultaneously add and remove
annotations one can pass a list
containing character
vectors
each assembled as described. The vectors are applied in the order they
appear in the list. To disable all annotations pass ""
or
c("=", "")
as argument. Adding a variation of an annotation already
present, replaces the existing one automatically: e.g., adding
"peak.labels"
replaces"peaks"
if present.
metadata retrieved from object object
is
paased to ggplot2::ggtitle()
as arguments for title
,
subtitle
and caption
. The specification for the title is
passed as argument to annotations
, and consists in the keyword
title
with optional modifiers selecting the kind of metatdata to
use, separated by colons. Up to three keywords separated by colons are
accepted, and correspond to title, subtitle and caption. The recognized
keywords are: "objt"
, "class"
, "what"
, "when"
,
"where"
, "how"
, "inst.name"
, "inst.sn"
,
"comment"
and "none"
are recognized as modifiers to
"title"
; "none"
is a placeholder. Default is
"title:objt"
or no title depending on the context.
If idfactor = NULL
, the default for single spectra, the name of
the factor is retrieved from metadata or if no metadata found, the default
"spct.idx"
is tried. The default for multiple spectra is to create a
factor named "spct.idx"
, but if a different name is passed, it will
be used instead, possibly renaming a pre-existing one.
normalize
,
calibration_spct
,
waveband
,
photobiologyWavebands-package
and
autoplot
Other autoplot methods:
autoplot.cps_spct()
,
autoplot.filter_spct()
,
autoplot.object_spct()
,
autoplot.raw_spct()
,
autoplot.reflector_spct()
,
autoplot.response_spct()
,
autoplot.source_spct()
,
autoplot.waveband()
,
set_annotations_default()
# to be added
# to be added
These methods return a ggplot object with an annotated plot of a
cps_spct
or a cps_mspct
object.
## S3 method for class 'cps_spct' autoplot( object, ..., w.band = getOption("photobiology.plot.bands", default = list(UVC(), UVB(), UVA(), PhR())), range = getOption("ggspectra.wlrange", default = NULL), norm = "skip", unit.out = NULL, pc.out = getOption("ggspectra.pc.out", default = FALSE), label.qty = "mean", span = NULL, wls.target = "HM", annotations = NULL, geom = "line", time.format = "", tz = "UTC", text.size = 2.5, idfactor = NULL, facets = FALSE, plot.data = "as.is", ylim = c(NA, NA), object.label = deparse(substitute(object)), na.rm = TRUE ) ## S3 method for class 'cps_mspct' autoplot( object, ..., range = getOption("ggspectra.wlrange", default = NULL), norm = "skip", unit.out = NULL, pc.out = getOption("ggspectra.pc.out", default = FALSE), idfactor = TRUE, facets = FALSE, plot.data = "as.is", object.label = deparse(substitute(object)), na.rm = TRUE )
## S3 method for class 'cps_spct' autoplot( object, ..., w.band = getOption("photobiology.plot.bands", default = list(UVC(), UVB(), UVA(), PhR())), range = getOption("ggspectra.wlrange", default = NULL), norm = "skip", unit.out = NULL, pc.out = getOption("ggspectra.pc.out", default = FALSE), label.qty = "mean", span = NULL, wls.target = "HM", annotations = NULL, geom = "line", time.format = "", tz = "UTC", text.size = 2.5, idfactor = NULL, facets = FALSE, plot.data = "as.is", ylim = c(NA, NA), object.label = deparse(substitute(object)), na.rm = TRUE ) ## S3 method for class 'cps_mspct' autoplot( object, ..., range = getOption("ggspectra.wlrange", default = NULL), norm = "skip", unit.out = NULL, pc.out = getOption("ggspectra.pc.out", default = FALSE), idfactor = TRUE, facets = FALSE, plot.data = "as.is", object.label = deparse(substitute(object)), na.rm = TRUE )
object |
a cps_spct object. |
... |
in the case of collections of spectra, additional arguments passed to the plot methods for individual spectra, otherwise currently ignored. |
w.band |
a single waveband object or a list of waveband objects. |
range |
an R object on which |
norm |
numeric Normalization wavelength (nm) or character string
|
unit.out |
character IGNORED. |
pc.out |
logical, if |
label.qty |
character string giving the type of summary quantity to use
for labels, one of |
span |
a peak is defined as an element in a sequence which is greater than all other elements within a window of width span centred at that element. |
wls.target |
numeric vector indicating the spectral quantity values for
which wavelengths are to be searched and interpolated if need. The
|
annotations |
a character vector. For details please see sections Plot Annotations and Title Annotations. |
geom |
character The name of a ggplot geometry, currently only
|
time.format |
character Format as accepted by
|
tz |
character Time zone to use for title and/or subtitle. |
text.size |
numeric size of text in the plot decorations. |
idfactor |
character Name of an index column in data holding a
|
facets |
logical or integer Indicating if facets are to be created for
the levels of |
plot.data |
character Data to plot. Default is |
ylim |
numeric y axis limits, |
object.label |
character The name of the object being plotted. |
na.rm |
logical. |
The plot object returned is a ggplot (an object of class
"gg"
) and it can be added to or modified as any other ggplot. The
axis labels are encoded as plotmath expressions as they contain
superscripts and special characters. In 'ggplot2', plotmath expressions do
not obey theme settings related to text fonts, except for size
.
Scale limits are expanded so as to make space for the annotations. If
annotations are disabled, limits are not expanded unless
reserve.space
is passed to parameter annotations
.
The generic of the autoplot
method is defined in
package 'ggplot2'. Package 'ggspectra' defines specializations for the
different classes for storage of spectral data defined in package
photobiology
.
A ggplot
object with a number of layers that depends on the
data and annotations.
The recognized annotation names are: "summaries"
, "peaks"
,
"peak.labels"
, "valleys"
, "valley.labels"
,
"wls"
, "wls.labels"
, "colour.guide"
,
"color.guide"
, "boxes"
, "segments"
, "labels"
.
In addition, "+"
is interpreted as a request to add to the already
present default annotations, "-"
as request to remove annotations
and "="
or missing"+"
and "-"
as a request to reset
annotations to those requested. If used, "+"
, "-"
or
"="
must be the first member of a character vector, and followed by
one or more of the names given above. To simultaneously add and remove
annotations one can pass a list
containing character
vectors
each assembled as described. The vectors are applied in the order they
appear in the list. To disable all annotations pass ""
or
c("=", "")
as argument. Adding a variation of an annotation already
present, replaces the existing one automatically: e.g., adding
"peak.labels"
replaces"peaks"
if present.
metadata retrieved from object object
is
paased to ggplot2::ggtitle()
as arguments for title
,
subtitle
and caption
. The specification for the title is
passed as argument to annotations
, and consists in the keyword
title
with optional modifiers selecting the kind of metatdata to
use, separated by colons. Up to three keywords separated by colons are
accepted, and correspond to title, subtitle and caption. The recognized
keywords are: "objt"
, "class"
, "what"
, "when"
,
"where"
, "how"
, "inst.name"
, "inst.sn"
,
"comment"
and "none"
are recognized as modifiers to
"title"
; "none"
is a placeholder. Default is
"title:objt"
or no title depending on the context.
If idfactor = NULL
, the default for single spectra, the name of
the factor is retrieved from metadata or if no metadata found, the default
"spct.idx"
is tried. The default for multiple spectra is to create a
factor named "spct.idx"
, but if a different name is passed, it will
be used instead, possibly renaming a pre-existing one.
normalize
,
cps_spct
,
waveband
,
photobiologyWavebands-package
and
autoplot
Other autoplot methods:
autoplot.calibration_spct()
,
autoplot.filter_spct()
,
autoplot.object_spct()
,
autoplot.raw_spct()
,
autoplot.reflector_spct()
,
autoplot.response_spct()
,
autoplot.source_spct()
,
autoplot.waveband()
,
set_annotations_default()
autoplot(white_led.cps_spct) autoplot(white_led.cps_spct, geom = "spct") autoplot(white_led.cps_spct, norm = "max") two_leds.mspct <- cps_mspct(list("LED 1" = white_led.cps_spct, "LED 2" = white_led.cps_spct / 2)) autoplot(two_leds.mspct) autoplot(two_leds.mspct, idfactor = "Spectra") autoplot(two_leds.mspct, plot.data = "mean")
autoplot(white_led.cps_spct) autoplot(white_led.cps_spct, geom = "spct") autoplot(white_led.cps_spct, norm = "max") two_leds.mspct <- cps_mspct(list("LED 1" = white_led.cps_spct, "LED 2" = white_led.cps_spct / 2)) autoplot(two_leds.mspct) autoplot(two_leds.mspct, idfactor = "Spectra") autoplot(two_leds.mspct, plot.data = "mean")
These methods return a ggplot object of an annotated plot from spectral data
contained in a filter_spct
or a filter_mspct
object. Data can
be expressed as absorbance, absorptance or transmittance.
## S3 method for class 'filter_spct' autoplot( object, ..., w.band = getOption("photobiology.plot.bands", default = list(UVC(), UVB(), UVA(), PhR())), range = getOption("ggspectra.wlrange", default = NULL), norm = getOption("ggspectra.norm", default = "update"), plot.qty = getOption("photobiology.filter.qty", default = "transmittance"), pc.out = getOption("ggspectra.pc.out", default = FALSE), label.qty = NULL, span = NULL, wls.target = "HM", annotations = NULL, geom = "line", time.format = "", tz = "UTC", text.size = 2.5, chroma.type = "CMF", idfactor = NULL, facets = FALSE, plot.data = "as.is", ylim = c(NA, NA), object.label = deparse(substitute(object)), na.rm = TRUE ) ## S3 method for class 'filter_mspct' autoplot( object, ..., range = getOption("ggspectra.wlrange", default = NULL), norm = getOption("ggspectra.norm", default = "update"), plot.qty = getOption("photobiology.filter.qty", default = "transmittance"), pc.out = getOption("ggspectra.pc.out", default = FALSE), plot.data = "as.is", idfactor = TRUE, facets = FALSE, object.label = deparse(substitute(object)), na.rm = TRUE )
## S3 method for class 'filter_spct' autoplot( object, ..., w.band = getOption("photobiology.plot.bands", default = list(UVC(), UVB(), UVA(), PhR())), range = getOption("ggspectra.wlrange", default = NULL), norm = getOption("ggspectra.norm", default = "update"), plot.qty = getOption("photobiology.filter.qty", default = "transmittance"), pc.out = getOption("ggspectra.pc.out", default = FALSE), label.qty = NULL, span = NULL, wls.target = "HM", annotations = NULL, geom = "line", time.format = "", tz = "UTC", text.size = 2.5, chroma.type = "CMF", idfactor = NULL, facets = FALSE, plot.data = "as.is", ylim = c(NA, NA), object.label = deparse(substitute(object)), na.rm = TRUE ) ## S3 method for class 'filter_mspct' autoplot( object, ..., range = getOption("ggspectra.wlrange", default = NULL), norm = getOption("ggspectra.norm", default = "update"), plot.qty = getOption("photobiology.filter.qty", default = "transmittance"), pc.out = getOption("ggspectra.pc.out", default = FALSE), plot.data = "as.is", idfactor = TRUE, facets = FALSE, object.label = deparse(substitute(object)), na.rm = TRUE )
object |
a filter_spct object or a filter_mspct object. |
... |
in the case of collections of spectra, additional arguments passed to the plot methods for individual spectra, otherwise currently ignored. |
w.band |
a single waveband object or a list of waveband objects. |
range |
an R object on which |
norm |
numeric Normalization wavelength (nm) or character string
|
plot.qty |
character string one of "transmittance" or "absorbance". |
pc.out |
logical, if |
label.qty |
character string giving the type of summary quantity to use
for labels, one of |
span |
a peak is defined as an element in a sequence which is greater than all other elements within a window of width span centred at that element. |
wls.target |
numeric vector indicating the spectral quantity values for
which wavelengths are to be searched and interpolated if need. The
|
annotations |
a character vector. For details please see sections Plot Annotations and Title Annotations. |
geom |
character The name of a ggplot geometry, currently only
|
time.format |
character Format as accepted by
|
tz |
character Time zone to use for title and/or subtitle. |
text.size |
numeric size of text in the plot decorations. |
chroma.type |
character one of |
idfactor |
character Name of an index column in data holding a
|
facets |
logical or integer Indicating if facets are to be created for
the levels of |
plot.data |
character Data to plot. Default is |
ylim |
numeric y axis limits, |
object.label |
character The name of the object being plotted. |
na.rm |
logical. |
The plot object returned is a ggplot (an object of class
"gg"
) and it can be added to or modified as any other ggplot. The
axis labels are encoded as plotmath expressions as they contain
superscripts and special characters. In 'ggplot2', plotmath expressions do
not obey theme settings related to text fonts, except for size
.
Scale limits are expanded so as to make space for the annotations. If
annotations are disabled, limits are not expanded unless
reserve.space
is passed to parameter annotations
.
The generic of the autoplot
method is defined in
package 'ggplot2'. Package 'ggspectra' defines specializations for the
different classes for storage of spectral data defined in package
photobiology
.
A ggplot
object with a number of layers that depends on the
data and annotations.
The recognized annotation names are: "summaries"
, "peaks"
,
"peak.labels"
, "valleys"
, "valley.labels"
,
"wls"
, "wls.labels"
, "colour.guide"
,
"color.guide"
, "boxes"
, "segments"
, "labels"
.
In addition, "+"
is interpreted as a request to add to the already
present default annotations, "-"
as request to remove annotations
and "="
or missing"+"
and "-"
as a request to reset
annotations to those requested. If used, "+"
, "-"
or
"="
must be the first member of a character vector, and followed by
one or more of the names given above. To simultaneously add and remove
annotations one can pass a list
containing character
vectors
each assembled as described. The vectors are applied in the order they
appear in the list. To disable all annotations pass ""
or
c("=", "")
as argument. Adding a variation of an annotation already
present, replaces the existing one automatically: e.g., adding
"peak.labels"
replaces"peaks"
if present.
metadata retrieved from object object
is
paased to ggplot2::ggtitle()
as arguments for title
,
subtitle
and caption
. The specification for the title is
passed as argument to annotations
, and consists in the keyword
title
with optional modifiers selecting the kind of metatdata to
use, separated by colons. Up to three keywords separated by colons are
accepted, and correspond to title, subtitle and caption. The recognized
keywords are: "objt"
, "class"
, "what"
, "when"
,
"where"
, "how"
, "inst.name"
, "inst.sn"
,
"comment"
and "none"
are recognized as modifiers to
"title"
; "none"
is a placeholder. Default is
"title:objt"
or no title depending on the context.
The plotting of absorbance is an exception to scale limits as the y-axis is not extended past 6 a.u. In the case of absorbance, values larger than 6 a.u. are rarely meaningful due to stray light during measurement. However, when transmittance values below the detection limit are rounded to zero, and later converted into absorbance, values Inf a.u. result, disrupting the plot. Scales are further expanded so as to make space for the annotations.
If idfactor = NULL
, the default for single spectra, the name of the
factor is retrieved from metadata or if no metadata found, the default
"spct.idx"
is tried. The default for multiple spectra is to create a
factor named "spct.idx"
, but if a different name is passed, it will
be used instead, possibly renaminig a pre-existing one.
normalize
,
filter_spct
,
waveband
,
photobiologyWavebands-package
and
autoplot
Other autoplot methods:
autoplot.calibration_spct()
,
autoplot.cps_spct()
,
autoplot.object_spct()
,
autoplot.raw_spct()
,
autoplot.reflector_spct()
,
autoplot.response_spct()
,
autoplot.source_spct()
,
autoplot.waveband()
,
set_annotations_default()
# one spectrum autoplot(yellow_gel.spct) autoplot(yellow_gel.spct, geom = "spct") autoplot(yellow_gel.spct, plot.qty = "transmittance") autoplot(yellow_gel.spct, plot.qty = "absorptance") autoplot(yellow_gel.spct, plot.qty = "absorbance") autoplot(yellow_gel.spct, pc.out = TRUE) autoplot(yellow_gel.spct, annotations = c("+", "wls")) # spectra for two filters in long form autoplot(two_filters.spct) autoplot(two_filters.spct, idfactor = "Spectra") autoplot(two_filters.spct, facets = TRUE) # spectra for two filters as a collection autoplot(two_filters.mspct) autoplot(two_filters.mspct, idfactor = "Spectra") autoplot(two_filters.mspct, facets = TRUE)
# one spectrum autoplot(yellow_gel.spct) autoplot(yellow_gel.spct, geom = "spct") autoplot(yellow_gel.spct, plot.qty = "transmittance") autoplot(yellow_gel.spct, plot.qty = "absorptance") autoplot(yellow_gel.spct, plot.qty = "absorbance") autoplot(yellow_gel.spct, pc.out = TRUE) autoplot(yellow_gel.spct, annotations = c("+", "wls")) # spectra for two filters in long form autoplot(two_filters.spct) autoplot(two_filters.spct, idfactor = "Spectra") autoplot(two_filters.spct, facets = TRUE) # spectra for two filters as a collection autoplot(two_filters.mspct) autoplot(two_filters.mspct, idfactor = "Spectra") autoplot(two_filters.mspct, facets = TRUE)
These methods return a ggplot object with an annotated plot of an
object_spct
or an object_spct
object. This objects contain
spectral transmittance, reflectance and possibly absorptance data. As these
quantities add up to one, only two are needed.
## S3 method for class 'object_spct' autoplot( object, ..., w.band = getOption("photobiology.plot.bands", default = list(UVC(), UVB(), UVA(), PhR())), range = getOption("ggspectra.wlrange", default = NULL), norm = "skip", plot.qty = "all", pc.out = getOption("ggspectra.pc.out", default = FALSE), label.qty = NULL, span = NULL, wls.target = "HM", annotations = NULL, geom = NULL, time.format = "", tz = "UTC", stacked = plot.qty == "all", text.size = 2.5, chroma.type = "CMF", idfactor = NULL, facets = NULL, plot.data = "as.is", ylim = c(NA, NA), object.label = deparse(substitute(object)), na.rm = TRUE ) ## S3 method for class 'object_mspct' autoplot( object, ..., range = getOption("ggspectra.wlrange", default = NULL), norm = "skip", plot.qty = getOption("photobiology.filter.qty", default = "all"), pc.out = getOption("ggspectra.pc.out", default = FALSE), plot.data = "as.is", idfactor = TRUE, facets = plot.qty == "all", object.label = deparse(substitute(object)), na.rm = TRUE )
## S3 method for class 'object_spct' autoplot( object, ..., w.band = getOption("photobiology.plot.bands", default = list(UVC(), UVB(), UVA(), PhR())), range = getOption("ggspectra.wlrange", default = NULL), norm = "skip", plot.qty = "all", pc.out = getOption("ggspectra.pc.out", default = FALSE), label.qty = NULL, span = NULL, wls.target = "HM", annotations = NULL, geom = NULL, time.format = "", tz = "UTC", stacked = plot.qty == "all", text.size = 2.5, chroma.type = "CMF", idfactor = NULL, facets = NULL, plot.data = "as.is", ylim = c(NA, NA), object.label = deparse(substitute(object)), na.rm = TRUE ) ## S3 method for class 'object_mspct' autoplot( object, ..., range = getOption("ggspectra.wlrange", default = NULL), norm = "skip", plot.qty = getOption("photobiology.filter.qty", default = "all"), pc.out = getOption("ggspectra.pc.out", default = FALSE), plot.data = "as.is", idfactor = TRUE, facets = plot.qty == "all", object.label = deparse(substitute(object)), na.rm = TRUE )
object |
an object_spct object |
... |
in the case of collections of spectra, additional arguments passed to the plot methods for individual spectra, otherwise currently ignored. |
w.band |
a single waveband object or a list of waveband objects. |
range |
an R object on which |
norm |
numeric Normalization wavelength (nm) or character string
|
plot.qty |
character string, one of "all", "transmittance", "absorbance", "absorptance", or "reflectance". |
pc.out |
logical, if |
label.qty |
character string giving the type of summary quantity to use
for labels, one of |
span |
a peak is defined as an element in a sequence which is greater than all other elements within a window of width span centred at that element. |
wls.target |
numeric vector indicating the spectral quantity values for
which wavelengths are to be searched and interpolated if need. The
|
annotations |
a character vector. For details please see sections Plot Annotations and Title Annotations. |
geom |
character The name of a ggplot geometry, currently only
|
time.format |
character Format as accepted by
|
tz |
character Time zone to use for title and/or subtitle. |
stacked |
logical Whether to use |
text.size |
numeric size of text in the plot decorations. |
chroma.type |
character one of |
idfactor |
character Name of an index column in data holding a
|
facets |
logical or integer Indicating if facets are to be created for
the levels of |
plot.data |
character Data to plot. Default is |
ylim |
numeric y axis limits, |
object.label |
character The name of the object being plotted. |
na.rm |
logical. |
The plot object returned is a ggplot (an object of class
"gg"
) and it can be added to or modified as any other ggplot. The
axis labels are encoded as plotmath expressions as they contain
superscripts and special characters. In 'ggplot2', plotmath expressions do
not obey theme settings related to text fonts, except for size
.
Scale limits are expanded so as to make space for the annotations. If
annotations are disabled, limits are not expanded unless
reserve.space
is passed to parameter annotations
.
The generic of the autoplot
method is defined in
package 'ggplot2'. Package 'ggspectra' defines specializations for the
different classes for storage of spectral data defined in package
photobiology
.
A ggplot
object with a number of layers that depends on the
data and annotations.
The recognized annotation names are: "summaries"
, "peaks"
,
"peak.labels"
, "valleys"
, "valley.labels"
,
"wls"
, "wls.labels"
, "colour.guide"
,
"color.guide"
, "boxes"
, "segments"
, "labels"
.
In addition, "+"
is interpreted as a request to add to the already
present default annotations, "-"
as request to remove annotations
and "="
or missing"+"
and "-"
as a request to reset
annotations to those requested. If used, "+"
, "-"
or
"="
must be the first member of a character vector, and followed by
one or more of the names given above. To simultaneously add and remove
annotations one can pass a list
containing character
vectors
each assembled as described. The vectors are applied in the order they
appear in the list. To disable all annotations pass ""
or
c("=", "")
as argument. Adding a variation of an annotation already
present, replaces the existing one automatically: e.g., adding
"peak.labels"
replaces"peaks"
if present.
metadata retrieved from object object
is
paased to ggplot2::ggtitle()
as arguments for title
,
subtitle
and caption
. The specification for the title is
passed as argument to annotations
, and consists in the keyword
title
with optional modifiers selecting the kind of metatdata to
use, separated by colons. Up to three keywords separated by colons are
accepted, and correspond to title, subtitle and caption. The recognized
keywords are: "objt"
, "class"
, "what"
, "when"
,
"where"
, "how"
, "inst.name"
, "inst.sn"
,
"comment"
and "none"
are recognized as modifiers to
"title"
; "none"
is a placeholder. Default is
"title:objt"
or no title depending on the context.
In the case of multiple spectra contained in the argument to
object
plotting is for plot.qty = "all"
is always done using
facets. Other plot quantities are handled by the methods for
filter_spct
and reflector_spct
objects after on-the-fly
conversion and the use of facets is possible but not the default.
If idfactor = NULL
, the default for single spectra, the name of the
factor is retrieved from metadata or if no metadata found, the default
"spct.idx" is tried. The default for multiple spectra is to create a factor
named "spct.idx", but if a different name is passed, it will be used
instead, possibly renaminig a pre-existing one.
normalize
,
object_spct
,
waveband
,
photobiologyWavebands-package
and
autoplot
Other autoplot methods:
autoplot.calibration_spct()
,
autoplot.cps_spct()
,
autoplot.filter_spct()
,
autoplot.raw_spct()
,
autoplot.reflector_spct()
,
autoplot.response_spct()
,
autoplot.source_spct()
,
autoplot.waveband()
,
set_annotations_default()
low_res.spct <- thin_wl(Ler_leaf.spct, max.wl.step = 20, max.slope.delta = 0.01, col.names = "Tfr") autoplot(low_res.spct) autoplot(low_res.spct, geom = "line") two_leaves.mspct <- object_mspct(list("Arabidopsis leaf 1" = low_res.spct, "Arabidopsis leaf 2" = low_res.spct)) autoplot(two_leaves.mspct, idfactor = "Spectra")
low_res.spct <- thin_wl(Ler_leaf.spct, max.wl.step = 20, max.slope.delta = 0.01, col.names = "Tfr") autoplot(low_res.spct) autoplot(low_res.spct, geom = "line") two_leaves.mspct <- object_mspct(list("Arabidopsis leaf 1" = low_res.spct, "Arabidopsis leaf 2" = low_res.spct)) autoplot(two_leaves.mspct, idfactor = "Spectra")
These methods construct a ggplot object with an annotated plot of a
raw_spct
or a raw_mspct
object.
## S3 method for class 'raw_spct' autoplot( object, ..., w.band = getOption("photobiology.plot.bands", default = list(UVC(), UVB(), UVA(), PhR())), range = getOption("ggspectra.wlrange", default = NULL), unit.out = "counts", pc.out = getOption("ggspectra.pc.out", default = FALSE), label.qty = "mean", span = NULL, wls.target = "HM", annotations = NULL, geom = "line", time.format = "", tz = "UTC", norm = "skip", text.size = 2.5, idfactor = NULL, facets = FALSE, plot.data = "as.is", ylim = c(NA, NA), object.label = deparse(substitute(object)), na.rm = TRUE ) ## S3 method for class 'raw_mspct' autoplot( object, ..., range = getOption("ggspectra.wlrange", default = NULL), norm = getOption("ggspectra.norm", default = "skip"), unit.out = "counts", pc.out = getOption("ggspectra.pc.out", default = FALSE), idfactor = TRUE, facets = FALSE, plot.data = "as.is", object.label = deparse(substitute(object)), na.rm = TRUE )
## S3 method for class 'raw_spct' autoplot( object, ..., w.band = getOption("photobiology.plot.bands", default = list(UVC(), UVB(), UVA(), PhR())), range = getOption("ggspectra.wlrange", default = NULL), unit.out = "counts", pc.out = getOption("ggspectra.pc.out", default = FALSE), label.qty = "mean", span = NULL, wls.target = "HM", annotations = NULL, geom = "line", time.format = "", tz = "UTC", norm = "skip", text.size = 2.5, idfactor = NULL, facets = FALSE, plot.data = "as.is", ylim = c(NA, NA), object.label = deparse(substitute(object)), na.rm = TRUE ) ## S3 method for class 'raw_mspct' autoplot( object, ..., range = getOption("ggspectra.wlrange", default = NULL), norm = getOption("ggspectra.norm", default = "skip"), unit.out = "counts", pc.out = getOption("ggspectra.pc.out", default = FALSE), idfactor = TRUE, facets = FALSE, plot.data = "as.is", object.label = deparse(substitute(object)), na.rm = TRUE )
object |
a raw_spct object. |
... |
in the case of collections of spectra, additional arguments passed to the plot methods for individual spectra, otherwise currently ignored. |
w.band |
a single waveband object or a list of waveband objects. |
range |
an R object on which |
unit.out |
character IGNORED. |
pc.out |
logical, if |
label.qty |
character string giving the type of summary quantity to use
for labels, one of |
span |
a peak is defined as an element in a sequence which is greater than all other elements within a window of width span centred at that element. |
wls.target |
numeric vector indicating the spectral quantity values for
which wavelengths are to be searched and interpolated if need. The
|
annotations |
a character vector. For details please see sections Plot Annotations and Title Annotations. |
geom |
character The name of a ggplot geometry, currently only
|
time.format |
character Format as accepted by
|
tz |
character Time zone to use for title and/or subtitle. |
norm |
numeric Normalization wavelength (nm) or character string
|
text.size |
numeric size of text in the plot decorations. |
idfactor |
character Name of an index column in data holding a
|
facets |
logical or integer Indicating if facets are to be created for
the levels of |
plot.data |
character Data to plot. Default is |
ylim |
numeric y axis limits, |
object.label |
character The name of the object being plotted. |
na.rm |
logical. |
The plot object returned is a ggplot (an object of class
"gg"
) and it can be added to or modified as any other ggplot. The
axis labels are encoded as plotmath expressions as they contain
superscripts and special characters. In 'ggplot2', plotmath expressions do
not obey theme settings related to text fonts, except for size
.
Scale limits are expanded so as to make space for the annotations. If
annotations are disabled, limits are not expanded unless
reserve.space
is passed to parameter annotations
.
The generic of the autoplot
method is defined in
package 'ggplot2'. Package 'ggspectra' defines specializations for the
different classes for storage of spectral data defined in package
photobiology
.
A ggplot
object with a number of layers that depends on the
data and annotations.
The recognized annotation names are: "summaries"
, "peaks"
,
"peak.labels"
, "valleys"
, "valley.labels"
,
"wls"
, "wls.labels"
, "colour.guide"
,
"color.guide"
, "boxes"
, "segments"
, "labels"
.
In addition, "+"
is interpreted as a request to add to the already
present default annotations, "-"
as request to remove annotations
and "="
or missing"+"
and "-"
as a request to reset
annotations to those requested. If used, "+"
, "-"
or
"="
must be the first member of a character vector, and followed by
one or more of the names given above. To simultaneously add and remove
annotations one can pass a list
containing character
vectors
each assembled as described. The vectors are applied in the order they
appear in the list. To disable all annotations pass ""
or
c("=", "")
as argument. Adding a variation of an annotation already
present, replaces the existing one automatically: e.g., adding
"peak.labels"
replaces"peaks"
if present.
metadata retrieved from object object
is
paased to ggplot2::ggtitle()
as arguments for title
,
subtitle
and caption
. The specification for the title is
passed as argument to annotations
, and consists in the keyword
title
with optional modifiers selecting the kind of metatdata to
use, separated by colons. Up to three keywords separated by colons are
accepted, and correspond to title, subtitle and caption. The recognized
keywords are: "objt"
, "class"
, "what"
, "when"
,
"where"
, "how"
, "inst.name"
, "inst.sn"
,
"comment"
and "none"
are recognized as modifiers to
"title"
; "none"
is a placeholder. Default is
"title:objt"
or no title depending on the context.
If idfactor = NULL
, the default for single spectra, the name of
the factor is retrieved from metadata or if no metadata found, the default
"spct.idx"
is tried. The default for multiple spectra is to create a
factor named "spct.idx"
, but if a different name is passed, it will
be used instead, possibly renaming a pre-existing one.
normalize
,
raw_spct
,
waveband
,
photobiologyWavebands-package
and
autoplot
Other autoplot methods:
autoplot.calibration_spct()
,
autoplot.cps_spct()
,
autoplot.filter_spct()
,
autoplot.object_spct()
,
autoplot.reflector_spct()
,
autoplot.response_spct()
,
autoplot.source_spct()
,
autoplot.waveband()
,
set_annotations_default()
low_res.raw_spct <- thin_wl(white_led.raw_spct, max.wl.step = 20, max.slope.delta = 0.05, col.names = "counts_3") autoplot(low_res.raw_spct) autoplot(low_res.raw_spct, annotations = "") two_leds.mspct <- raw_mspct(list("LED 1" = low_res.raw_spct, "LED 2" = low_res.raw_spct)) autoplot(two_leds.mspct) autoplot(two_leds.mspct, facets = 1) # one column
low_res.raw_spct <- thin_wl(white_led.raw_spct, max.wl.step = 20, max.slope.delta = 0.05, col.names = "counts_3") autoplot(low_res.raw_spct) autoplot(low_res.raw_spct, annotations = "") two_leds.mspct <- raw_mspct(list("LED 1" = low_res.raw_spct, "LED 2" = low_res.raw_spct)) autoplot(two_leds.mspct) autoplot(two_leds.mspct, facets = 1) # one column
These methods return a ggplot object for an annotated plot from spectral data
stored in a reflector_spct
or a reflector_mspct
object.
## S3 method for class 'reflector_spct' autoplot( object, ..., w.band = getOption("photobiology.plot.bands", default = list(UVC(), UVB(), UVA(), PhR())), range = getOption("ggspectra.wlrange", default = NULL), norm = getOption("ggspectra.norm", default = "update"), plot.qty = getOption("photobiology.reflector.qty", default = "reflectance"), pc.out = getOption("ggspectra.pc.out", default = FALSE), label.qty = NULL, span = NULL, wls.target = "HM", annotations = NULL, geom = "line", time.format = "", tz = "UTC", text.size = 2.5, chroma.type = "CMF", idfactor = NULL, facets = FALSE, plot.data = "as.is", ylim = c(NA, NA), object.label = deparse(substitute(object)), na.rm = TRUE ) ## S3 method for class 'reflector_mspct' autoplot( object, ..., range = getOption("ggspectra.wlrange", default = NULL), norm = getOption("ggspectra.normalize", default = "update"), plot.qty = getOption("photobiology.reflector.qty", default = "reflectance"), pc.out = getOption("ggspectra.pc.out", default = FALSE), plot.data = "as.is", idfactor = TRUE, facets = FALSE, object.label = deparse(substitute(object)), na.rm = TRUE )
## S3 method for class 'reflector_spct' autoplot( object, ..., w.band = getOption("photobiology.plot.bands", default = list(UVC(), UVB(), UVA(), PhR())), range = getOption("ggspectra.wlrange", default = NULL), norm = getOption("ggspectra.norm", default = "update"), plot.qty = getOption("photobiology.reflector.qty", default = "reflectance"), pc.out = getOption("ggspectra.pc.out", default = FALSE), label.qty = NULL, span = NULL, wls.target = "HM", annotations = NULL, geom = "line", time.format = "", tz = "UTC", text.size = 2.5, chroma.type = "CMF", idfactor = NULL, facets = FALSE, plot.data = "as.is", ylim = c(NA, NA), object.label = deparse(substitute(object)), na.rm = TRUE ) ## S3 method for class 'reflector_mspct' autoplot( object, ..., range = getOption("ggspectra.wlrange", default = NULL), norm = getOption("ggspectra.normalize", default = "update"), plot.qty = getOption("photobiology.reflector.qty", default = "reflectance"), pc.out = getOption("ggspectra.pc.out", default = FALSE), plot.data = "as.is", idfactor = TRUE, facets = FALSE, object.label = deparse(substitute(object)), na.rm = TRUE )
object |
a reflector_spct object or a reflector_mspct object. |
... |
in the case of collections of spectra, additional arguments passed to the plot methods for individual spectra, otherwise currently ignored. |
w.band |
a single waveband object or a list of waveband objects. |
range |
an R object on which |
norm |
numeric Normalization wavelength (nm) or character string
|
plot.qty |
character string (currently ignored). |
pc.out |
logical, if |
label.qty |
character string giving the type of summary quantity to use
for labels, one of |
span |
a peak is defined as an element in a sequence which is greater than all other elements within a window of width span centred at that element. |
wls.target |
numeric vector indicating the spectral quantity values for
which wavelengths are to be searched and interpolated if need. The
|
annotations |
a character vector. For details please see sections Plot Annotations and Title Annotations. |
geom |
character The name of a ggplot geometry, currently only
|
time.format |
character Format as accepted by
|
tz |
character Time zone to use for title and/or subtitle. |
text.size |
numeric size of text in the plot decorations. |
chroma.type |
character one of |
idfactor |
character Name of an index column in data holding a
|
facets |
logical or integer Indicating if facets are to be created for
the levels of |
plot.data |
character Data to plot. Default is |
ylim |
numeric y axis limits, |
object.label |
character The name of the object being plotted. |
na.rm |
logical. |
The plot object returned is a ggplot (an object of class
"gg"
) and it can be added to or modified as any other ggplot. The
axis labels are encoded as plotmath expressions as they contain
superscripts and special characters. In 'ggplot2', plotmath expressions do
not obey theme settings related to text fonts, except for size
.
Scale limits are expanded so as to make space for the annotations. If
annotations are disabled, limits are not expanded unless
reserve.space
is passed to parameter annotations
.
The generic of the autoplot
method is defined in
package 'ggplot2'. Package 'ggspectra' defines specializations for the
different classes for storage of spectral data defined in package
photobiology
.
A ggplot
object with a number of layers that depends on the
data and annotations.
The recognized annotation names are: "summaries"
, "peaks"
,
"peak.labels"
, "valleys"
, "valley.labels"
,
"wls"
, "wls.labels"
, "colour.guide"
,
"color.guide"
, "boxes"
, "segments"
, "labels"
.
In addition, "+"
is interpreted as a request to add to the already
present default annotations, "-"
as request to remove annotations
and "="
or missing"+"
and "-"
as a request to reset
annotations to those requested. If used, "+"
, "-"
or
"="
must be the first member of a character vector, and followed by
one or more of the names given above. To simultaneously add and remove
annotations one can pass a list
containing character
vectors
each assembled as described. The vectors are applied in the order they
appear in the list. To disable all annotations pass ""
or
c("=", "")
as argument. Adding a variation of an annotation already
present, replaces the existing one automatically: e.g., adding
"peak.labels"
replaces"peaks"
if present.
metadata retrieved from object object
is
paased to ggplot2::ggtitle()
as arguments for title
,
subtitle
and caption
. The specification for the title is
passed as argument to annotations
, and consists in the keyword
title
with optional modifiers selecting the kind of metatdata to
use, separated by colons. Up to three keywords separated by colons are
accepted, and correspond to title, subtitle and caption. The recognized
keywords are: "objt"
, "class"
, "what"
, "when"
,
"where"
, "how"
, "inst.name"
, "inst.sn"
,
"comment"
and "none"
are recognized as modifiers to
"title"
; "none"
is a placeholder. Default is
"title:objt"
or no title depending on the context.
If idfactor = NULL
, the default for single spectra, the name of
the factor is retrieved from metadata or if no metadata found, the default
"spct.idx"
is tried. The default for multiple spectra is to create a
factor named "spct.idx"
, but if a different name is passed, it will
be used instead, possibly renaming a pre-existing one.
normalize
,
reflector_spct
,
waveband
,
photobiologyWavebands-package
and
autoplot
Other autoplot methods:
autoplot.calibration_spct()
,
autoplot.cps_spct()
,
autoplot.filter_spct()
,
autoplot.object_spct()
,
autoplot.raw_spct()
,
autoplot.response_spct()
,
autoplot.source_spct()
,
autoplot.waveband()
,
set_annotations_default()
autoplot(Ler_leaf_rflt.spct) autoplot(Ler_leaf_rflt.spct, geom = "spct") autoplot(Ler_leaf_rflt.spct, annotations = c("+", "valleys")) two_leaves.mspct <- reflector_mspct(list("Arabidopsis leaf 1" = Ler_leaf_rflt.spct, "Arabidopsis leaf 2" = Ler_leaf_rflt.spct / 2)) autoplot(two_leaves.mspct) autoplot(two_leaves.mspct, idfactor = "Spectra") autoplot(two_leaves.mspct, facets = 2)
autoplot(Ler_leaf_rflt.spct) autoplot(Ler_leaf_rflt.spct, geom = "spct") autoplot(Ler_leaf_rflt.spct, annotations = c("+", "valleys")) two_leaves.mspct <- reflector_mspct(list("Arabidopsis leaf 1" = Ler_leaf_rflt.spct, "Arabidopsis leaf 2" = Ler_leaf_rflt.spct / 2)) autoplot(two_leaves.mspct) autoplot(two_leaves.mspct, idfactor = "Spectra") autoplot(two_leaves.mspct, facets = 2)
These methods return a ggplot object with an annotated plot of the spectral
data contained in a response_spct
or a response_mspct
object.
Spectral responsitivity can be expressed either on an energy basis or a photon
or quantum basis.
## S3 method for class 'response_spct' autoplot( object, ..., w.band = getOption("photobiology.plot.bands", default = list(UVC(), UVB(), UVA(), PhR())), range = getOption("ggspectra.wlrange", default = NULL), norm = getOption("ggspectra.norm", default = "update"), unit.out = getOption("photobiology.radiation.unit", default = "energy"), pc.out = getOption("ggspectra.pc.out", default = FALSE), label.qty = NULL, span = NULL, wls.target = "HM", annotations = NULL, geom = "line", time.format = "", tz = "UTC", text.size = 2.5, idfactor = NULL, facets = FALSE, plot.data = "as.is", ylim = c(NA, NA), object.label = deparse(substitute(object)), na.rm = TRUE ) ## S3 method for class 'response_mspct' autoplot( object, ..., range = getOption("ggspectra.wlrange", default = NULL), norm = getOption("ggspectra.norm", default = "update"), unit.out = getOption("photobiology.radiation.unit", default = "energy"), pc.out = getOption("ggspectra.pc.out", default = FALSE), plot.data = "as.is", facets = FALSE, idfactor = TRUE, object.label = deparse(substitute(object)), na.rm = TRUE )
## S3 method for class 'response_spct' autoplot( object, ..., w.band = getOption("photobiology.plot.bands", default = list(UVC(), UVB(), UVA(), PhR())), range = getOption("ggspectra.wlrange", default = NULL), norm = getOption("ggspectra.norm", default = "update"), unit.out = getOption("photobiology.radiation.unit", default = "energy"), pc.out = getOption("ggspectra.pc.out", default = FALSE), label.qty = NULL, span = NULL, wls.target = "HM", annotations = NULL, geom = "line", time.format = "", tz = "UTC", text.size = 2.5, idfactor = NULL, facets = FALSE, plot.data = "as.is", ylim = c(NA, NA), object.label = deparse(substitute(object)), na.rm = TRUE ) ## S3 method for class 'response_mspct' autoplot( object, ..., range = getOption("ggspectra.wlrange", default = NULL), norm = getOption("ggspectra.norm", default = "update"), unit.out = getOption("photobiology.radiation.unit", default = "energy"), pc.out = getOption("ggspectra.pc.out", default = FALSE), plot.data = "as.is", facets = FALSE, idfactor = TRUE, object.label = deparse(substitute(object)), na.rm = TRUE )
object |
a |
... |
in the case of collections of spectra, additional arguments passed to the plot methods for individual spectra, otherwise currently ignored. |
w.band |
a single waveband object or a list of waveband objects. |
range |
an R object on which |
norm |
numeric Normalization wavelength (nm) or character string
|
unit.out |
character string indicating type of radiation units to use
for plotting: |
pc.out |
logical, if |
label.qty |
character string giving the type of summary quantity to use
for labels, one of |
span |
a peak is defined as an element in a sequence which is greater than all other elements within a window of width span centred at that element. |
wls.target |
numeric vector indicating the spectral quantity values for
which wavelengths are to be searched and interpolated if need. The
|
annotations |
a character vector. For details please see sections Plot Annotations and Title Annotations. |
geom |
character The name of a ggplot geometry, currently only
|
time.format |
character Format as accepted by
|
tz |
character Time zone to use for title and/or subtitle. |
text.size |
numeric size of text in the plot decorations. |
idfactor |
character Name of an index column in data holding a
|
facets |
logical or integer Indicating if facets are to be created for
the levels of |
plot.data |
character Data to plot. Default is |
ylim |
numeric y axis limits, |
object.label |
character The name of the object being plotted. |
na.rm |
logical. |
The plot object returned is a ggplot (an object of class
"gg"
) and it can be added to or modified as any other ggplot. The
axis labels are encoded as plotmath expressions as they contain
superscripts and special characters. In 'ggplot2', plotmath expressions do
not obey theme settings related to text fonts, except for size
.
Scale limits are expanded so as to make space for the annotations. If
annotations are disabled, limits are not expanded unless
reserve.space
is passed to parameter annotations
.
The generic of the autoplot
method is defined in
package 'ggplot2'. Package 'ggspectra' defines specializations for the
different classes for storage of spectral data defined in package
photobiology
.
A ggplot
object with a number of layers that depends on the
data and annotations.
The recognized annotation names are: "summaries"
, "peaks"
,
"peak.labels"
, "valleys"
, "valley.labels"
,
"wls"
, "wls.labels"
, "colour.guide"
,
"color.guide"
, "boxes"
, "segments"
, "labels"
.
In addition, "+"
is interpreted as a request to add to the already
present default annotations, "-"
as request to remove annotations
and "="
or missing"+"
and "-"
as a request to reset
annotations to those requested. If used, "+"
, "-"
or
"="
must be the first member of a character vector, and followed by
one or more of the names given above. To simultaneously add and remove
annotations one can pass a list
containing character
vectors
each assembled as described. The vectors are applied in the order they
appear in the list. To disable all annotations pass ""
or
c("=", "")
as argument. Adding a variation of an annotation already
present, replaces the existing one automatically: e.g., adding
"peak.labels"
replaces"peaks"
if present.
metadata retrieved from object object
is
paased to ggplot2::ggtitle()
as arguments for title
,
subtitle
and caption
. The specification for the title is
passed as argument to annotations
, and consists in the keyword
title
with optional modifiers selecting the kind of metatdata to
use, separated by colons. Up to three keywords separated by colons are
accepted, and correspond to title, subtitle and caption. The recognized
keywords are: "objt"
, "class"
, "what"
, "when"
,
"where"
, "how"
, "inst.name"
, "inst.sn"
,
"comment"
and "none"
are recognized as modifiers to
"title"
; "none"
is a placeholder. Default is
"title:objt"
or no title depending on the context.
If idfactor = NULL
, the default for single spectra, the name of
the factor is retrieved from metadata or if no metadata found, the default
"spct.idx"
is tried. The default for multiple spectra is to create a
factor named "spct.idx"
, but if a different name is passed, it will
be used instead, possibly renaming a pre-existing one.
normalize
,
response_spct
,
waveband
,
photobiologyWavebands-package
and
autoplot
Other autoplot methods:
autoplot.calibration_spct()
,
autoplot.cps_spct()
,
autoplot.filter_spct()
,
autoplot.object_spct()
,
autoplot.raw_spct()
,
autoplot.reflector_spct()
,
autoplot.source_spct()
,
autoplot.waveband()
,
set_annotations_default()
autoplot(photodiode.spct) autoplot(photodiode.spct, geom = "spct") autoplot(photodiode.spct, unit.out = "photon") autoplot(photodiode.spct, annotations = "") autoplot(photodiode.spct, norm = "skip") autoplot(photodiode.spct, norm = 400) two_sensors.mspct <- response_mspct(list("Photodiode" = photodiode.spct, "Coupled charge device" = ccd.spct)) autoplot(two_sensors.mspct, normalize = TRUE, unit.out = "photon") autoplot(two_sensors.mspct, normalize = TRUE, idfactor = "Spectra") autoplot(two_sensors.mspct, normalize = TRUE, facets = 2) autoplot(two_sensors.mspct, normalize = TRUE, geom = "spct")
autoplot(photodiode.spct) autoplot(photodiode.spct, geom = "spct") autoplot(photodiode.spct, unit.out = "photon") autoplot(photodiode.spct, annotations = "") autoplot(photodiode.spct, norm = "skip") autoplot(photodiode.spct, norm = 400) two_sensors.mspct <- response_mspct(list("Photodiode" = photodiode.spct, "Coupled charge device" = ccd.spct)) autoplot(two_sensors.mspct, normalize = TRUE, unit.out = "photon") autoplot(two_sensors.mspct, normalize = TRUE, idfactor = "Spectra") autoplot(two_sensors.mspct, normalize = TRUE, facets = 2) autoplot(two_sensors.mspct, normalize = TRUE, geom = "spct")
These methods return a ggplot object with an annotated plot of the spectral
data contained in a source_spct
or a source_mspct
object.
## S3 method for class 'source_spct' autoplot( object, ..., w.band = getOption("photobiology.plot.bands", default = list(photobiologyWavebands::UVC(), photobiologyWavebands::UVB(), photobiologyWavebands::UVA(), photobiologyWavebands::PhR())), range = getOption("ggspectra.wlrange", default = NULL), norm = getOption("ggspectra.norm", default = "update"), unit.out = getOption("photobiology.radiation.unit", default = "energy"), pc.out = getOption("ggspectra.pc.out", default = FALSE), label.qty = NULL, span = NULL, wls.target = "HM", annotations = NULL, geom = "line", time.format = "", tz = "UTC", text.size = 2.5, chroma.type = "CMF", idfactor = NULL, facets = FALSE, plot.data = "as.is", ylim = c(NA, NA), object.label = deparse(substitute(object)), na.rm = TRUE ) ## S3 method for class 'source_mspct' autoplot( object, ..., range = getOption("ggspectra.wlrange", default = NULL), norm = getOption("ggspectra.normalize", default = "update"), unit.out = getOption("photobiology.radiation.unit", default = "energy"), pc.out = getOption("ggspectra.pc.out", default = FALSE), idfactor = TRUE, facets = FALSE, plot.data = "as.is", object.label = deparse(substitute(object)), na.rm = TRUE )
## S3 method for class 'source_spct' autoplot( object, ..., w.band = getOption("photobiology.plot.bands", default = list(photobiologyWavebands::UVC(), photobiologyWavebands::UVB(), photobiologyWavebands::UVA(), photobiologyWavebands::PhR())), range = getOption("ggspectra.wlrange", default = NULL), norm = getOption("ggspectra.norm", default = "update"), unit.out = getOption("photobiology.radiation.unit", default = "energy"), pc.out = getOption("ggspectra.pc.out", default = FALSE), label.qty = NULL, span = NULL, wls.target = "HM", annotations = NULL, geom = "line", time.format = "", tz = "UTC", text.size = 2.5, chroma.type = "CMF", idfactor = NULL, facets = FALSE, plot.data = "as.is", ylim = c(NA, NA), object.label = deparse(substitute(object)), na.rm = TRUE ) ## S3 method for class 'source_mspct' autoplot( object, ..., range = getOption("ggspectra.wlrange", default = NULL), norm = getOption("ggspectra.normalize", default = "update"), unit.out = getOption("photobiology.radiation.unit", default = "energy"), pc.out = getOption("ggspectra.pc.out", default = FALSE), idfactor = TRUE, facets = FALSE, plot.data = "as.is", object.label = deparse(substitute(object)), na.rm = TRUE )
object |
a source_spct or a source_mspct object. |
... |
in the case of collections of spectra, additional arguments passed to the plot methods for individual spectra, otherwise currently ignored. |
w.band |
a single waveband object or a list of waveband objects. |
range |
an R object on which |
norm |
numeric Normalization wavelength (nm) or character string
|
unit.out |
character string indicating type of radiation units to use
for plotting: |
pc.out |
logical, if |
label.qty |
character string giving the type of summary quantity to use
for labels, one of |
span |
a peak is defined as an element in a sequence which is greater than all other elements within a window of width span centred at that element. |
wls.target |
numeric vector indicating the spectral quantity values for
which wavelengths are to be searched and interpolated if need. The
|
annotations |
a character vector. For details please see sections Plot Annotations and Title Annotations. |
geom |
character The name of a ggplot geometry, currently only
|
time.format |
character Format as accepted by
|
tz |
character Time zone to use for title and/or subtitle. |
text.size |
numeric size of text in the plot decorations. |
chroma.type |
character one of |
idfactor |
character Name of an index column in data holding a
|
facets |
logical or integer Indicating if facets are to be created for
the levels of |
plot.data |
character Data to plot. Default is |
ylim |
numeric y axis limits, |
object.label |
character The name of the object being plotted. |
na.rm |
logical. |
The plot object returned is a ggplot (an object of class
"gg"
) and it can be added to or modified as any other ggplot. The
axis labels are encoded as plotmath expressions as they contain
superscripts and special characters. In 'ggplot2', plotmath expressions do
not obey theme settings related to text fonts, except for size
.
Scale limits are expanded so as to make space for the annotations. If
annotations are disabled, limits are not expanded unless
reserve.space
is passed to parameter annotations
.
The generic of the autoplot
method is defined in
package 'ggplot2'. Package 'ggspectra' defines specializations for the
different classes for storage of spectral data defined in package
photobiology
.
A ggplot
object with a number of layers that depends on the
data and annotations.
The recognized annotation names are: "summaries"
, "peaks"
,
"peak.labels"
, "valleys"
, "valley.labels"
,
"wls"
, "wls.labels"
, "colour.guide"
,
"color.guide"
, "boxes"
, "segments"
, "labels"
.
In addition, "+"
is interpreted as a request to add to the already
present default annotations, "-"
as request to remove annotations
and "="
or missing"+"
and "-"
as a request to reset
annotations to those requested. If used, "+"
, "-"
or
"="
must be the first member of a character vector, and followed by
one or more of the names given above. To simultaneously add and remove
annotations one can pass a list
containing character
vectors
each assembled as described. The vectors are applied in the order they
appear in the list. To disable all annotations pass ""
or
c("=", "")
as argument. Adding a variation of an annotation already
present, replaces the existing one automatically: e.g., adding
"peak.labels"
replaces"peaks"
if present.
metadata retrieved from object object
is
paased to ggplot2::ggtitle()
as arguments for title
,
subtitle
and caption
. The specification for the title is
passed as argument to annotations
, and consists in the keyword
title
with optional modifiers selecting the kind of metatdata to
use, separated by colons. Up to three keywords separated by colons are
accepted, and correspond to title, subtitle and caption. The recognized
keywords are: "objt"
, "class"
, "what"
, "when"
,
"where"
, "how"
, "inst.name"
, "inst.sn"
,
"comment"
and "none"
are recognized as modifiers to
"title"
; "none"
is a placeholder. Default is
"title:objt"
or no title depending on the context.
If idfactor = NULL
, the default for single spectra, the name of
the factor is retrieved from metadata or if no metadata found, the default
"spct.idx"
is tried. The default for multiple spectra is to create a
factor named "spct.idx"
, but if a different name is passed, it will
be used instead, possibly renaming a pre-existing one.
normalize
,
source_spct
,
waveband
,
photobiologyWavebands-package
and
autoplot
Other autoplot methods:
autoplot.calibration_spct()
,
autoplot.cps_spct()
,
autoplot.filter_spct()
,
autoplot.object_spct()
,
autoplot.raw_spct()
,
autoplot.reflector_spct()
,
autoplot.response_spct()
,
autoplot.waveband()
,
set_annotations_default()
autoplot(sun.spct) autoplot(sun.spct, geom = "spct") autoplot(sun.spct, unit.out = "photon") autoplot(sun.spct, norm = "max") autoplot(sun.spct, norm = "max", pc.out = TRUE) # multiple spectra in long form autoplot(sun_evening.spct) autoplot(sun_evening.spct, facets = 1) # one column autoplot(sun_evening.spct, facets = 2) # two columns autoplot(sun_evening.spct, plot.data = "mean") # needs 'photobiology' (> 0.11.2) # autoplot(sun_evening.spct, idfactor = "Sequence") # multiple spectra as a collection autoplot(sun_evening.mspct) autoplot(sun_evening.mspct, facets = 1) # one column autoplot(sun_evening.mspct, facets = 2) # two columns autoplot(sun_evening.mspct, plot.data = "mean") autoplot(sun_evening.mspct, idfactor = "Time")
autoplot(sun.spct) autoplot(sun.spct, geom = "spct") autoplot(sun.spct, unit.out = "photon") autoplot(sun.spct, norm = "max") autoplot(sun.spct, norm = "max", pc.out = TRUE) # multiple spectra in long form autoplot(sun_evening.spct) autoplot(sun_evening.spct, facets = 1) # one column autoplot(sun_evening.spct, facets = 2) # two columns autoplot(sun_evening.spct, plot.data = "mean") # needs 'photobiology' (> 0.11.2) # autoplot(sun_evening.spct, idfactor = "Sequence") # multiple spectra as a collection autoplot(sun_evening.mspct) autoplot(sun_evening.mspct, facets = 1) # one column autoplot(sun_evening.mspct, facets = 2) # two columns autoplot(sun_evening.mspct, plot.data = "mean") autoplot(sun_evening.mspct, idfactor = "Time")
This function returns a ggplot object with an annotated plot of a
waveband
object.
## S3 method for class 'waveband' autoplot( object, ..., w.length = NULL, range = c(280, 800), fill = 0, span = NULL, wls.target = "HM", unit.in = getOption("photobiology.radiation.unit", default = "energy"), annotations = NULL, geom = "line", wb.trim = TRUE, norm = NULL, text.size = 2.5, ylim = c(NA, NA), object.label = deparse(substitute(object)), na.rm = TRUE )
## S3 method for class 'waveband' autoplot( object, ..., w.length = NULL, range = c(280, 800), fill = 0, span = NULL, wls.target = "HM", unit.in = getOption("photobiology.radiation.unit", default = "energy"), annotations = NULL, geom = "line", wb.trim = TRUE, norm = NULL, text.size = 2.5, ylim = c(NA, NA), object.label = deparse(substitute(object)), na.rm = TRUE )
object |
a waveband object. |
... |
currently ignored. |
w.length |
numeric vector of wavelengths (nm) |
range |
an R object on which range() returns a vector of length 2, with min annd max wavelengths (nm). |
fill |
value to use as response for wavelngths outside the waveband range. |
span |
a peak is defined as an element in a sequence which is greater than all other elements within a window of width span centered at that element. |
wls.target |
numeric vector indicating the spectral quantity values for
which wavelengths are to be searched and interpolated if need. The
|
unit.in |
the type of unit we assume as reference "energy" or "photon" based. |
annotations |
a character vector. For details please see section Plot Annotations. |
geom |
character The name of a ggplot geometry, currently only
|
wb.trim |
logical. |
norm |
numeric normalization wavelength (nm) or character string "max" for normalization at the wavelength of highest peak. |
text.size |
numeric size of text in the plot decorations. |
ylim |
numeric y axis limits, |
object.label |
character The name of the object being plotted. |
na.rm |
logical. |
Note that scales are expanded so as to make space for the annotations. The object returned is a ggplot object, and can be further manipulated.
a ggplot
object.
The recognized annotation names are: "summaries"
, "peaks"
,
"peak.labels"
, "valleys"
, "valley.labels"
,
"wls"
, "wls.labels"
, "colour.guide"
,
"color.guide"
, "boxes"
, "segments"
, "labels"
.
In addition, "+"
is interpreted as a request to add to the already
present default annotations, "-"
as request to remove annotations
and "="
or missing"+"
and "-"
as a request to reset
annotations to those requested. If used, "+"
, "-"
or
"="
must be the first member of a character vector, and followed by
one or more of the names given above. To simultaneously add and remove
annotations one can pass a list
containing character
vectors
each assembled as described. The vectors are applied in the order they
appear in the list. To disable all annotations pass ""
or
c("=", "")
as argument. Adding a variation of an annotation already
present, replaces the existing one automatically: e.g., adding
"peak.labels"
replaces"peaks"
if present.
Effectiveness spectra are plotted expressing the spectral effectiveness
either as photons of
which can selected through
formal argument
unit.out
. The value of unit.in
has no effect on
the result when uisng BSWFs, as BSWFs are defined based on a certain base of
expression, which is enforced. In contrast, for wavebands which only define a
wavelength range, changing the assumed reference irradiance, changes the
responsivity according to Plank's law.
This function creates a response_spct
object from the waveband
object and plots it. Unused arguments are passed along, which means that
other plot aspects can be controlled by providing arguments for the plot
method of the response_spct
class.
autoplot.response_spct
,
waveband
.
Other autoplot methods:
autoplot.calibration_spct()
,
autoplot.cps_spct()
,
autoplot.filter_spct()
,
autoplot.object_spct()
,
autoplot.raw_spct()
,
autoplot.reflector_spct()
,
autoplot.response_spct()
,
autoplot.source_spct()
,
set_annotations_default()
autoplot(waveband(c(400, 500))) autoplot(waveband(c(400, 500)), geom = "spct")
autoplot(waveband(c(400, 500))) autoplot(waveband(c(400, 500)), geom = "spct")
Add a title, subtitle and caption to a spectral plot based on automatically extracted metadata from an spectral object.
autotitle( object, object.label = deparse(substitute(object)), annotations = "title", time.format = NULL, tz = "", default.title = "title:objt" ) ggtitle_spct( object, object.label = deparse(substitute(object)), annotations = "title", time.format = NULL, tz = "", default.title = "title:objt" )
autotitle( object, object.label = deparse(substitute(object)), annotations = "title", time.format = NULL, tz = "", default.title = "title:objt" ) ggtitle_spct( object, object.label = deparse(substitute(object)), annotations = "title", time.format = NULL, tz = "", default.title = "title:objt" )
object |
generic_spct or generic_mspct The spectral object plotted. |
object.label |
character The name of the object being plotted. |
annotations |
character vector Annotations as described for
|
time.format |
character Format as accepted by
|
tz |
character time zone used in labels. |
default.title |
character vector The default used for |
The return value of ggplot2::labs()
.
metadata retrieved from object object
is
paased to ggplot2::ggtitle()
as arguments for title
,
subtitle
and caption
. The specification for the title is
passed as argument to annotations
, and consists in the keyword
title
with optional modifiers selecting the kind of metatdata to
use, separated by colons. Up to three keywords separated by colons are
accepted, and correspond to title, subtitle and caption. The recognized
keywords are: "objt"
, "class"
, "what"
, "when"
,
"where"
, "how"
, "inst.name"
, "inst.sn"
,
"comment"
and "none"
are recognized as modifiers to
"title"
; "none"
is a placeholder. Default is
"title:objt"
or no title depending on the context.
Method renamed as autotitle()
to better reflect its function;
ggtitle_spct()
is deprecated but will remain available for backwards
compatibility.
p <- ggplot(sun.spct) + geom_line() p + autotitle(sun.spct) p + autotitle(sun.spct, object.label = "The terrestrial solar spectrum") p + autotitle(sun.spct, annotations = "title:objt:class") p + autotitle(sun.spct, annotations = "title:where:when:how") p <- ggplot(sun_evening.spct) + aes(linetype = spct.idx) + geom_line() p + autotitle(sun_evening.spct, annotations = "title:objt:class") p + autotitle(sun_evening.spct, annotations = "title:where:when:how") p + autotitle(sun_evening.spct, annotations = "title:none:none:how") p <- ggplot(sun_evening.mspct) + aes(linetype = spct.idx) + geom_line() p + autotitle(sun_evening.mspct, annotations = "title:objt:class")
p <- ggplot(sun.spct) + geom_line() p + autotitle(sun.spct) p + autotitle(sun.spct, object.label = "The terrestrial solar spectrum") p + autotitle(sun.spct, annotations = "title:objt:class") p + autotitle(sun.spct, annotations = "title:where:when:how") p <- ggplot(sun_evening.spct) + aes(linetype = spct.idx) + geom_line() p + autotitle(sun_evening.spct, annotations = "title:objt:class") p + autotitle(sun_evening.spct, annotations = "title:where:when:how") p + autotitle(sun_evening.spct, annotations = "title:none:none:how") p <- ggplot(sun_evening.mspct) + aes(linetype = spct.idx) + geom_line() p + autotitle(sun_evening.mspct, annotations = "title:objt:class")
Texts used by default for axis labels in plots are recalled from character vectors returned by these functions. The aim is that their default values can be easily changed or translated to other languages. They contain only the text part, but not symbols or units of expression.
axis_labels_uk(append = "", sep = "") axis_labels_uk_comma() axis_labels_none() axis_labels()
axis_labels_uk(append = "", sep = "") axis_labels_uk_comma() axis_labels_none() axis_labels()
append |
character The string to be appended to each label, |
sep |
character Passed to function |
By default axis_labels()
contains a copy of
axis_labels_uk_comma()
. By assigning to this name a user function
that returns a named character vector using the same names as those
returned by these functions, it is possible to temporarily change
the default texts.
Currently only UK English label texts are predefined and
axis_labels()
is a synonym of axis_labels_uk()
.
A character vector
axis_labels()[["w.length"]] # ending in a comma axis_labels_uk()[["w.length"]] # no comma axis_labels_none()[["w.length"]] # empty label
axis_labels()[["w.length"]] # ending in a comma axis_labels_uk()[["w.length"]] # no comma axis_labels_none()[["w.length"]] # empty label
Chose black or white color based on a color to be used as background.
Usefull when using geom_text
on top of tiles or bars, or
geom_label
with a variable fill.
black_or_white(colors, threshold = 0.45)
black_or_white(colors, threshold = 0.45)
colors |
character A vector of color definitions. |
threshold |
numeric in range 0 to 1. |
black_or_white("red") black_or_white(colors()[1:10])
black_or_white("red") black_or_white(colors()[1:10])
Color-checker-chart ggplot labelled with color names or with indexes of the colors in the vector passed as first argument.
color_chart( colors = grDevices::colors(), ncol = NULL, use.names = NULL, text.size = 2, text.color = NULL, grid.color = "white" )
color_chart( colors = grDevices::colors(), ncol = NULL, use.names = NULL, text.size = 2, text.color = NULL, grid.color = "white" )
colors |
character A vector of color definitions. |
ncol |
integer Number of column in the checker grid. |
use.names |
logical Force use of names or indexes. |
text.size |
numeric Size of the text labels drawn on each color tile. |
text.color |
character Color definition, used for text on tiles. |
grid.color |
character Color definition, used for grid lines between tiles. |
Default text.color
uses black_or_white()
to ensure enough
contrast. Default for use.names
depends on number of columns in the
grid, indexes are used when columns are seven or more.
color_chart() color_chart(grep("dark", colors(), value = TRUE), text.size = 3.5)
color_chart() color_chart(grep("dark", colors(), value = TRUE), text.size = 3.5)
Generate axis labels in SI units, using SI scale factors. Output can be selected as character, expression (R default devices) or LaTeX (for tikz device).
counts_label( unit.exponent = 3, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["counts"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) )
counts_label( unit.exponent = 3, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["counts"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) )
unit.exponent |
integer |
format |
character string, "R", "R.expresion", "R.character", or "LaTeX". |
label.text |
character Textual portion of the labels. |
scaled |
logical If |
normalized |
logical ( |
axis.symbols |
logical If |
a character string or an R expression.
counts_label() counts_label("R.expression") counts_label("LaTeX")
counts_label() counts_label("R.expression") counts_label("LaTeX")
Generate pixel response rate axis labels in cps units. Output can be selected as character, expression (R default devices) or LaTeX (for tikz device).
cps_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["cps"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) )
cps_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["cps"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) )
unit.exponent |
integer |
format |
character string, "R", "R.expresion", "R.character", or "LaTeX". |
label.text |
character Textual portion of the labels. |
scaled |
logical If |
normalized |
logical ( |
axis.symbols |
logical If |
a character string or an R expression.
cps_label() cps_label(3) cps_label(format = "R.expression") cps_label(format = "R.character") cps_label(format = "LaTeX") cps_label(3, format = "LaTeX")
cps_label() cps_label(3) cps_label(format = "R.expression") cps_label(format = "R.character") cps_label(format = "LaTeX") cps_label(3, format = "LaTeX")
Convert SI unit prefixes into exponents of ten of multipliers and vice-versa.
exponent2prefix( exponent, char.set = getOption("photobiology.fancy.chars", default = "utf8") ) exponent2factor(exponent = 0, if.zero.exponent = "1") exponent2prefix_name(exponent) prefix_name2exponent(name) prefix2exponent( prefix, char.set = getOption("photobiology.fancy.chars", default = "utf8") ) has_SI_prefix(exponent) nearest_SI_exponent(exponent)
exponent2prefix( exponent, char.set = getOption("photobiology.fancy.chars", default = "utf8") ) exponent2factor(exponent = 0, if.zero.exponent = "1") exponent2prefix_name(exponent) prefix_name2exponent(name) prefix2exponent( prefix, char.set = getOption("photobiology.fancy.chars", default = "utf8") ) has_SI_prefix(exponent) nearest_SI_exponent(exponent)
exponent |
numeric The power of 10 of the unit multiplier. |
char.set |
character How to encode Greek letters and other fancy
characters in prefixes: |
if.zero.exponent |
character string to return when exponent is equal to zero. |
name |
character Long SI name of multiplier. |
prefix |
character Unit prefix used for multiplier. |
To change the default char.set
, set R option
"photobiology.fancy.chars"
. Implementation is based on a table of
data and extensible to any alphabet supported by R character objects by
expanding the table.
exponent2prefix(3) exponent2prefix(0) exponent2prefix(-6) exponent2factor(3) exponent2factor(0) exponent2factor(0, NULL) exponent2factor(0, "") exponent2factor(-6)
exponent2prefix(3) exponent2prefix(0) exponent2prefix(-6) exponent2factor(3) exponent2factor(0) exponent2factor(0, NULL) exponent2factor(0, "") exponent2factor(-6)
For each continuous x value, geom_spct
displays a y interval.
geom_spct
is a special case of geom_area
, where the minimum of
the range is fixed to 0, but stacking is not enabled.
geom_spct( mapping = NULL, data = NULL, stat = "identity", position = "identity", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
geom_spct( mapping = NULL, data = NULL, stat = "identity", position = "identity", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
mapping |
The aesthetic mapping, usually constructed with
|
data |
A data frame. If specified, overrides the default data frame defined at the top level of the plot. |
stat |
The statistical transformation to use on the data for this layer, as a string. |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
... |
other arguments passed on to |
na.rm |
If FALSE (the default), removes missing values with a warning. If TRUE silently removes missing values. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
An spectrum plot is the analog of a line plot (see geom_path
),
and can be used to show how y varies over the range of x. The difference is that
the area under the line is filled.
See geom_ribbon
geom_ribbon
for stacked areas,
geom_path
for lines (lines),
geom_point
for scatter plots.
# ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + geom_spct()
# ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + geom_spct()
ggplot()
initializes a ggplot object. It can be used to declare the
input spectral object for a graphic and to optionally specify the set of plot
aesthetics intended to be common throughout all subsequent layers unless
specifically overridden.
## S3 method for class 'source_spct' ggplot( data, mapping = NULL, ..., range = NULL, unit.out = getOption("photobiology.radiation.unit", default = "energy"), environment = parent.frame() ) ## S3 method for class 'response_spct' ggplot( data, mapping = NULL, ..., range = NULL, unit.out = getOption("photobiology.radiation.unit", default = "energy"), environment = parent.frame() ) ## S3 method for class 'filter_spct' ggplot( data, mapping = NULL, ..., range = NULL, plot.qty = getOption("photobiology.filter.qty", default = "transmittance"), environment = parent.frame() ) ## S3 method for class 'reflector_spct' ggplot( data, mapping = NULL, ..., range = NULL, plot.qty = NULL, environment = parent.frame() ) ## S3 method for class 'cps_spct' ggplot(data, mapping = NULL, ..., range = NULL, environment = parent.frame()) ## S3 method for class 'calibration_spct' ggplot(data, mapping = NULL, ..., range = NULL, environment = parent.frame()) ## S3 method for class 'raw_spct' ggplot(data, mapping = NULL, ..., range = NULL, environment = parent.frame()) ## S3 method for class 'object_spct' ggplot( data, mapping = NULL, ..., range = NULL, plot.qty = getOption("photobiology.object.qty", default = "all"), environment = parent.frame() ) ## S3 method for class 'generic_spct' ggplot( data, mapping = NULL, ..., range = NULL, spct_class, environment = parent.frame() ) ## S3 method for class 'generic_mspct' ggplot(data, mapping = NULL, ..., range = NULL, environment = parent.frame()) ## S3 method for class 'filter_mspct' ggplot( data, mapping = NULL, ..., range = NULL, plot.qty = getOption("photobiology.filter.qty", default = "transmittance"), environment = parent.frame() ) ## S3 method for class 'source_mspct' ggplot( data, mapping = NULL, ..., range = NULL, unit.out = getOption("photobiology.radiation.unit", default = "energy"), environment = parent.frame() ) ## S3 method for class 'object_mspct' ggplot( data, mapping = NULL, ..., range = NULL, plot.qty = getOption("photobiology.object.qty", default = ifelse(length(data) > 1L, "as.is", "all")), environment = parent.frame() )
## S3 method for class 'source_spct' ggplot( data, mapping = NULL, ..., range = NULL, unit.out = getOption("photobiology.radiation.unit", default = "energy"), environment = parent.frame() ) ## S3 method for class 'response_spct' ggplot( data, mapping = NULL, ..., range = NULL, unit.out = getOption("photobiology.radiation.unit", default = "energy"), environment = parent.frame() ) ## S3 method for class 'filter_spct' ggplot( data, mapping = NULL, ..., range = NULL, plot.qty = getOption("photobiology.filter.qty", default = "transmittance"), environment = parent.frame() ) ## S3 method for class 'reflector_spct' ggplot( data, mapping = NULL, ..., range = NULL, plot.qty = NULL, environment = parent.frame() ) ## S3 method for class 'cps_spct' ggplot(data, mapping = NULL, ..., range = NULL, environment = parent.frame()) ## S3 method for class 'calibration_spct' ggplot(data, mapping = NULL, ..., range = NULL, environment = parent.frame()) ## S3 method for class 'raw_spct' ggplot(data, mapping = NULL, ..., range = NULL, environment = parent.frame()) ## S3 method for class 'object_spct' ggplot( data, mapping = NULL, ..., range = NULL, plot.qty = getOption("photobiology.object.qty", default = "all"), environment = parent.frame() ) ## S3 method for class 'generic_spct' ggplot( data, mapping = NULL, ..., range = NULL, spct_class, environment = parent.frame() ) ## S3 method for class 'generic_mspct' ggplot(data, mapping = NULL, ..., range = NULL, environment = parent.frame()) ## S3 method for class 'filter_mspct' ggplot( data, mapping = NULL, ..., range = NULL, plot.qty = getOption("photobiology.filter.qty", default = "transmittance"), environment = parent.frame() ) ## S3 method for class 'source_mspct' ggplot( data, mapping = NULL, ..., range = NULL, unit.out = getOption("photobiology.radiation.unit", default = "energy"), environment = parent.frame() ) ## S3 method for class 'object_mspct' ggplot( data, mapping = NULL, ..., range = NULL, plot.qty = getOption("photobiology.object.qty", default = ifelse(length(data) > 1L, "as.is", "all")), environment = parent.frame() )
data |
Default spectrum dataset to use for plot. If not a spectrum, the
methods used will be those defined in package |
mapping |
Default list of aesthetic mappings to use for plot. If not specified, in the case of spectral objects, a default mapping will be used. |
... |
Other arguments passed on to methods. |
range |
an R object on which range() returns a vector of length 2, with min and max wavelengths (nm). |
unit.out |
character string indicating type of units to use for
plotting spectral irradiance or spectral response, |
environment |
If a variable defined in the aesthetic mapping is not
found in the data, ggplot will look for it in this environment. It defaults
to using the environment in which |
plot.qty |
character string One of |
spct_class |
character Class into which a |
ggplot()
is typically used to construct a plot incrementally, using
the +
operator to add layers to the existing ggplot object. This is
advantageous in that the code is explicit about which layers are added and
the order in which they are added. For complex graphics with multiple layers,
initialization with ggplot
is recommended.
We show seven common ways to invoke ggplot
for spectra and
collections of spectra:
ggplot(spct)
ggplot(spct, unit.out = <unit.to.use>)
ggplot(spct, plot.qty = <quantity.to.plot>)
ggplot(spct, range = <wavelength.range>)
ggplot(spct) + aes(<other aesthetics>)
ggplot(spct, aes(x, y, <other aesthetics>))
ggplot(spct, aes())
The first method is recommended if all layers use the same data and the same set of automatic default x and y aesthetics. The second, third and fourth use automatic default x and y aesthetics but first transform or trim the spectral data to be plotted. The fifth uses automatic default x and y aesthetics and adds mappings for other aesthetics. These patterns can be combined as needed. The sixth disables the use of a default automatic mapping, while the seventh delays the mapping of aesthetics and can be convenient when using different mappings for different geoms.
In the case of class object_spct, the arguments
"all"
and "as.is"
if passed to plot.qty
, indicate in
the first case that the data are to be converted into long form, to allow
stacking, while in the second case data
is copied unchanged to the
plot object. "reflectance"
passed to plot.qty
converts
data
into a replector_spct
object and "absorbance"
,
"absorptance"
and "reflectance"
, convert data
into a
filter_spct
.
The method for collections of spectra
accepts arguments for the same parameters as the corresponding methods for
single spectra. Heterogeneous generic collections of spectra are not
supported. When plotting collections of spectra the factor spct.idx
contains as levels the names of the individual members of the collection,
and can be mapped to aesthetics or used for faceting.
Current implementation does not merge the default mapping with user
supplied mapping. If user supplies a mapping, it is used as is, and
variables should be present in the spectral object. In contrast, when using
the default mapping, unit or quantity conversions are done on the fly when
needed. To add to the default mapping, aes()
can be used by itself
to compose the ggplot. In all cases, except when an object_spct
is
converted into long form, the data member of the returned plot object
retains its class and attributes.
plot.qty is ignored for reflectors.
ggplot(sun.spct) + geom_line() ggplot(sun.spct, unit.out = "photon") + geom_line() ggplot(yellow_gel.spct) + geom_line() ggplot(yellow_gel.spct, plot.qty = "absorbance") + geom_line() ggplot(Ler_leaf.spct) + facet_grid(~variable) + geom_line() ggplot(Ler_leaf.spct) + aes(linetype = variable) + geom_line()
ggplot(sun.spct) + geom_line() ggplot(sun.spct, unit.out = "photon") + geom_line() ggplot(yellow_gel.spct) + geom_line() ggplot(yellow_gel.spct, plot.qty = "absorbance") + geom_line() ggplot(Ler_leaf.spct) + facet_grid(~variable) + geom_line() ggplot(Ler_leaf.spct) + aes(linetype = variable) + geom_line()
Calibration multipliers axis labels. Output can be selected as character, expression (R default devices) or LaTeX (for tikz device).
multipliers_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["e.mult"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) )
multipliers_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["e.mult"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) )
unit.exponent |
integer |
format |
character string, "R", "R.expression", "R.character", or "LaTeX". |
label.text |
character Textual portion of the labels. |
scaled |
logical If |
normalized |
logical ( |
axis.symbols |
logical If |
a character string or an R expression.
multipliers_label() multipliers_label(3) multipliers_label(format = "R.expression") multipliers_label(format = "R.character") multipliers_label(format = "LaTeX") multipliers_label(3, format = "LaTeX")
multipliers_label() multipliers_label(3) multipliers_label(format = "R.expression") multipliers_label(format = "R.character") multipliers_label(format = "LaTeX") multipliers_label(3, format = "LaTeX")
Grid based; allows multiple plots arraged in a matrix and print
ed to
any R device. ggplot objects can be passed in ..., or to plotlist (as a list
of ggplot objects)
multiplot( ..., plotlist = NULL, ncol = 1, cols = ncol, layout = NULL, title = "", title.position = "left", title.fontsize = 12, title.fontfamily = "sans", title.fontface = "bold", title.colour = "black" )
multiplot( ..., plotlist = NULL, ncol = 1, cols = ncol, layout = NULL, title = "", title.position = "left", title.fontsize = 12, title.fontfamily = "sans", title.fontface = "bold", title.colour = "black" )
... |
one or more ggplot objects. |
plotlist |
list of ggplot objects. |
ncol , cols
|
numerical Number of columns in layout. |
layout |
A numeric matrix specifying the layout. If present, 'cols' is ignored. |
title |
character vector Title of the composite plot. |
title.position |
numeric or character, the horizontal position of the title. |
title.fontsize |
numeric |
title.fontfamily |
character e.g. "sans", "serif", "mono". |
title.fontface |
character e.g. "plain", "bold", "italic", "bold.italic". |
title.colour |
character e.g. "black", "red". |
ggplot objects can be passed in ..., or to plotlist (as a list of ggplot objects) If the layout is something like matrix(c(1,2,3,3), nrow=2, byrow=TRUE), then plot 1 will go in the upper left, 2 will go in the upper right, and 3 will go all the way across the bottom.
Modified from example by Winston Chang found in the Cookbook for R Licenced under CC BY-SA
multiplot(plot(sun.spct), plot(yellow_gel.spct), ncol = 1) multiplot(plot(sun.spct), plot(yellow_gel.spct), ncol = 1, title = "The sun and a yellow filter")
multiplot(plot(sun.spct), plot(yellow_gel.spct), ncol = 1) multiplot(plot(sun.spct), plot(yellow_gel.spct), ncol = 1, title = "The sun and a yellow filter")
These plot()
methods return a ggplot object with an annotated plot of
an object of a class derived from generic_spct
, of a class derived
from generic_mspct
or of an object of class waveband
for which
an autoplot()
method exists. They are implemented as wrappers of
autoplot()
. The generic for plot()
is defined by base R and
specializations for objects of diverse classes are provided various packages
and R itself. The generic for autoplot()
is defined by package
'ggplot2'.
## S3 method for class 'generic_spct' plot(x, ...) ## S3 method for class 'generic_mspct' plot(x, ...) ## S3 method for class 'waveband' plot(x, ...)
## S3 method for class 'generic_spct' plot(x, ...) ## S3 method for class 'generic_mspct' plot(x, ...) ## S3 method for class 'waveband' plot(x, ...)
x |
An R object derived from class |
... |
Named arguments passed to |
a ggplot
object.
These plot()
specializatioms are provided for backwards
compatibility, but all new or updated code should call autoplot()
instead of plot()
on objects of spectral and waveband classes defined
in package 'photobiology'.
These methods add support for plot()
specializations as these
specialization were provided by package 'ggspectra' years ago, before
'ggplot2' had an autoplot()
generic. As these methods return ggplots
autoplot is a more suitable name for them.
autoplot.calibration_spct
, autoplot.cps_spct
,
autoplot.filter_spct
, autoplot.raw_spct
,
autoplot.response_spct
, autoplot.source_spct
and
autoplot.waveband
.
plot(sun.spct) # deprecated syntax, to be avoided autoplot(sun.spct) # current syntax, to be used
plot(sun.spct) # deprecated syntax, to be avoided autoplot(sun.spct) # current syntax, to be used
Generate spectral reflectance labels in SI units, using SI scale factors. Output can be selected as character, expression (R default devices) or LaTeX (for tikz device).
Rfr_label( unit.exponent = ifelse(pc.out, -2, 0), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE), Rfr.type ) Rfr_specular_label( unit.exponent = ifelse(pc.out, -2, 0), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE) )
Rfr_label( unit.exponent = ifelse(pc.out, -2, 0), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE), Rfr.type ) Rfr_specular_label( unit.exponent = ifelse(pc.out, -2, 0), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE) )
unit.exponent |
integer |
format |
character string, "R", "R.expresion", "R.character", or "LaTeX". |
label.text |
character Textual portion of the labels. |
scaled |
logical If |
normalized |
logical ( |
axis.symbols |
logical If |
pc.out |
logical, if TRUE use percent as default instead of fraction of one. |
Rfr.type |
character, either "total" or "specular". |
a character string or an R expression.
Default for label.text
depends on the value passed as argument
to Rfr.type
.
Rfr_label(Rfr.type = "specular") Rfr_label(Rfr.type = "total") Rfr_specular_label() Rfr_specular_label(axis.symbols = FALSE) Rfr_specular_label(-2) Rfr_specular_label(-3) Rfr_specular_label(format = "R.expression") Rfr_specular_label(format = "LaTeX") Rfr_specular_label(-3, format = "LaTeX")
Rfr_label(Rfr.type = "specular") Rfr_label(Rfr.type = "total") Rfr_specular_label() Rfr_specular_label(axis.symbols = FALSE) Rfr_specular_label(-2) Rfr_specular_label(-3) Rfr_specular_label(format = "R.expression") Rfr_specular_label(format = "LaTeX") Rfr_specular_label(-3, format = "LaTeX")
Generate axis labels for spectral irradiance in SI units, using SI scale factors. Output can be selected as character, expression (R default devices) or LaTeX (for tikz device).
s.e.irrad_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.e.irrad"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) s.q.irrad_label( unit.exponent = ifelse(normalized, 0, -6), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.q.irrad"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) )
s.e.irrad_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.e.irrad"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) s.q.irrad_label( unit.exponent = ifelse(normalized, 0, -6), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.q.irrad"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) )
unit.exponent |
integer. |
format |
character string, "R", "R.expresion", "R.character", or "LaTeX". |
label.text |
character Textual portion of the labels. |
scaled |
logical If |
normalized |
logical ( |
axis.symbols |
logical If |
a character string or an R expression.
str(s.e.irrad_label()) str(s.e.irrad_label(axis.symbols = FALSE)) str(s.e.irrad_label(format = "R.expression")) str(s.e.irrad_label(format = "LaTeX")) str(s.q.irrad_label()) str(s.q.irrad_label(axis.symbols = FALSE)) str(s.q.irrad_label(format = "R.expression")) str(s.q.irrad_label(format = "LaTeX"))
str(s.e.irrad_label()) str(s.e.irrad_label(axis.symbols = FALSE)) str(s.e.irrad_label(format = "R.expression")) str(s.e.irrad_label(format = "LaTeX")) str(s.q.irrad_label()) str(s.q.irrad_label(axis.symbols = FALSE)) str(s.q.irrad_label(format = "R.expression")) str(s.q.irrad_label(format = "LaTeX"))
Generate axis labels for response or action spectra in SI units, using SI scale factors. Output can be selected as character, expression (R default devices) or LaTeX (for tikz device).
s.e.response_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.e.response"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) s.q.response_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.q.response"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) s.e.action_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.e.action"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) s.q.action_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.q.action"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) )
s.e.response_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.e.response"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) s.q.response_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.q.response"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) s.e.action_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.e.action"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) s.q.action_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.q.action"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) )
unit.exponent |
integer |
format |
character string, "R", "R.expression", "R.character", or "LaTeX". |
label.text |
character Textual portion of the labels. |
scaled |
logical If |
normalized |
logical ( |
axis.symbols |
logical If |
a character string or an R expression.
s.e.response_label() s.e.response_label(format = "R.expression") s.e.response_label(format = "R.character") s.e.response_label(format = "LaTeX") s.e.response_label(unit.exponent = 3, format = "R.character") s.q.response_label(format = "R.character") s.e.action_label(format = "R.character") s.q.action_label(format = "R.character") s.e.response_label(scaled = TRUE) s.e.response_label(scaled = TRUE, format = "R.character") s.e.response_label(scaled = TRUE, format = "LaTeX") s.e.response_label(normalized = 300) s.e.response_label(normalized = 300, format = "R.character") s.e.response_label(normalized = 300, format = "LaTeX") s.q.response_label(scaled = TRUE) s.q.response_label(scaled = TRUE, format = "R.character") s.q.response_label(scaled = TRUE, format = "LaTeX") s.q.response_label(normalized = 300) s.q.response_label(normalized = 300, format = "R.character") s.q.response_label(normalized = 300, format = "LaTeX")
s.e.response_label() s.e.response_label(format = "R.expression") s.e.response_label(format = "R.character") s.e.response_label(format = "LaTeX") s.e.response_label(unit.exponent = 3, format = "R.character") s.q.response_label(format = "R.character") s.e.action_label(format = "R.character") s.q.action_label(format = "R.character") s.e.response_label(scaled = TRUE) s.e.response_label(scaled = TRUE, format = "R.character") s.e.response_label(scaled = TRUE, format = "LaTeX") s.e.response_label(normalized = 300) s.e.response_label(normalized = 300, format = "R.character") s.e.response_label(normalized = 300, format = "LaTeX") s.q.response_label(scaled = TRUE) s.q.response_label(scaled = TRUE, format = "R.character") s.q.response_label(scaled = TRUE, format = "LaTeX") s.q.response_label(normalized = 300) s.q.response_label(normalized = 300, format = "R.character") s.q.response_label(normalized = 300, format = "LaTeX")
Scale x continuous with defaults suitable for wavelengths expressed as energy per photon [eV] or [J].
scale_x_energy_eV_continuous( unit.exponent = 0, name = w_energy_eV_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), label.text = axis_labels()[["energy"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... ) scale_x_energy_J_continuous( unit.exponent = -18, name = w_energy_J_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), label.text = axis_labels()[["energy"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... )
scale_x_energy_eV_continuous( unit.exponent = 0, name = w_energy_eV_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), label.text = axis_labels()[["energy"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... ) scale_x_energy_J_continuous( unit.exponent = -18, name = w_energy_J_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), label.text = axis_labels()[["energy"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... )
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 |
... |
other named arguments passed to |
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
.
This function only alters two default arguments, please, see
documentation for scale_continuous
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)
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)
Scale x continuous with defaults suitable for wavelengths expressed as frequencies [Hz].
scale_x_frequency_continuous( unit.exponent = 12, name = w_frequency_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), label.text = axis_labels()[["freq"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... )
scale_x_frequency_continuous( unit.exponent = 12, name = w_frequency_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), label.text = axis_labels()[["freq"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... )
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 |
... |
other named arguments passed to |
This scale automates the generation of axis labels when the variable
mapped to the x aesthetic contains numeric values for wavelengths
expressed as frequency. This is not how spectral data are stored in
the packages of the R for Photobiology suite and can be only 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
.
This function only alters two default arguments, please, see
documentation for scale_continuous
ggplot(sun.spct, aes(x = wl2frequency(w.length), y = s.e.irrad)) + geom_line() + scale_x_frequency_continuous() ggplot(sun.spct, aes(x = wl2frequency(w.length), y = s.e.irrad)) + geom_line() + scale_x_frequency_continuous(14)
ggplot(sun.spct, aes(x = wl2frequency(w.length), y = s.e.irrad)) + geom_line() + scale_x_frequency_continuous() ggplot(sun.spct, aes(x = wl2frequency(w.length), y = s.e.irrad)) + geom_line() + scale_x_frequency_continuous(14)
Scale x continuous with defaults suitable for wavelengths expressed as
wavenumbers [].
scale_x_wavenumber_continuous( unit.exponent = -6, name = w_number_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), label.text = axis_labels()[["w.number"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... )
scale_x_wavenumber_continuous( unit.exponent = -6, name = w_number_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), label.text = axis_labels()[["w.number"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... )
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 |
... |
other named arguments passed to |
This scale automates the generation of axis labels when the variable
mapped to the x aesthetic contains numeric values for wavelengths
expressed wavenumbers. 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
.
This function only alters two default arguments, please, see
documentation for scale_continuous
ggplot(sun.spct, aes(x = wl2wavenumber(w.length), y = s.e.irrad)) + geom_line() + scale_x_wavenumber_continuous() ggplot(sun.spct, aes(x = wl2wavenumber(w.length), y = s.e.irrad)) + geom_line() + scale_x_wavenumber_continuous(unit.exponent = -5)
ggplot(sun.spct, aes(x = wl2wavenumber(w.length), y = s.e.irrad)) + geom_line() + scale_x_wavenumber_continuous() ggplot(sun.spct, aes(x = wl2wavenumber(w.length), y = s.e.irrad)) + geom_line() + scale_x_wavenumber_continuous(unit.exponent = -5)
Scale x continuous with defaults suitable for wavelengths in nanometres.
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), ... )
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), ... )
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 |
... |
other named arguments passed to |
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'.
This function only alters two default arguments, please, see
documentation for scale_continuous
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)
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)
Scale y continuous with defaults suitable for spectral absorbance.
scale_y_A_continuous( unit.exponent = 0, name = A_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols, Tfr.type = Tfr.type), labels = SI_pl_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), Tfr.type, ... ) scale_y_A_internal_continuous( unit.exponent = 0, name = A_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols, Tfr.type = "internal"), labels = SI_pl_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... ) scale_y_A_total_continuous( unit.exponent = 0, name = A_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols, Tfr.type = "total"), labels = SI_pl_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... )
scale_y_A_continuous( unit.exponent = 0, name = A_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols, Tfr.type = Tfr.type), labels = SI_pl_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), Tfr.type, ... ) scale_y_A_internal_continuous( unit.exponent = 0, name = A_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols, Tfr.type = "internal"), labels = SI_pl_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... ) scale_y_A_total_continuous( unit.exponent = 0, name = A_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols, Tfr.type = "total"), labels = SI_pl_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... )
unit.exponent |
integer |
name |
The name of the scale, used for the axis-label. |
labels |
The tick labels or a function to generate them. |
format |
character string, "R", "R.expression", "R.character", or "LaTeX". |
label.text |
character Textual portion of the labels. |
scaled |
logical If |
normalized |
logical ( |
axis.symbols |
logical If |
Tfr.type |
character, either "total" or "internal". |
... |
other named arguments passed to |
This function only alters two default arguments, please, see
documentation for scale_continuous
ggplot(yellow_gel.spct, plot.qty = "absorbance") + geom_line() + scale_y_A_continuous(Tfr.type = getTfrType(yellow_gel.spct)) + scale_x_wl_continuous() ggplot(yellow_gel.spct, plot.qty = "absorbance") + geom_line() + scale_y_A_internal_continuous() + scale_x_wl_continuous() ggplot(yellow_gel.spct, plot.qty = "absorbance") + geom_line() + scale_y_A_total_continuous() + scale_x_wl_continuous() ggplot(yellow_gel.spct, plot.qty = "absorbance") + geom_line() + scale_y_A_total_continuous(axis.symbols = FALSE) + scale_x_wl_continuous(axis.symbols = FALSE)
ggplot(yellow_gel.spct, plot.qty = "absorbance") + geom_line() + scale_y_A_continuous(Tfr.type = getTfrType(yellow_gel.spct)) + scale_x_wl_continuous() ggplot(yellow_gel.spct, plot.qty = "absorbance") + geom_line() + scale_y_A_internal_continuous() + scale_x_wl_continuous() ggplot(yellow_gel.spct, plot.qty = "absorbance") + geom_line() + scale_y_A_total_continuous() + scale_x_wl_continuous() ggplot(yellow_gel.spct, plot.qty = "absorbance") + geom_line() + scale_y_A_total_continuous(axis.symbols = FALSE) + scale_x_wl_continuous(axis.symbols = FALSE)
Scale y continuous with defaults suitable for spectral absorptance.
scale_y_Afr_continuous( unit.exponent = ifelse(pc.out, -2, 0), name = Afr_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = unit.exponent), limits = c(0, 1), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.Afr"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE), ... )
scale_y_Afr_continuous( unit.exponent = ifelse(pc.out, -2, 0), name = Afr_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = unit.exponent), limits = c(0, 1), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.Afr"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE), ... )
unit.exponent |
integer |
name |
The name of the scale, used for the axis-label. |
labels |
The tick labels or a function to generate them. |
limits |
One of |
format |
character string, "R", "R.expression", "R.character", or "LaTeX". |
label.text |
character Textual portion of the labels. |
scaled |
logical If |
normalized |
logical ( |
axis.symbols |
logical If |
pc.out |
logical, if TRUE use percent as default instead of fraction of one. |
... |
other named arguments passed to |
This function only alters two default arguments, please, see
documentation for scale_continuous
Afr_as_default() ggplot(yellow_gel.spct) + geom_line() + scale_y_Afr_continuous() + scale_x_wl_continuous() ggplot(yellow_gel.spct) + geom_line() + scale_y_Afr_continuous(unit.exponent = -2) + scale_x_wl_continuous() ggplot(yellow_gel.spct) + geom_line() + scale_y_Afr_continuous(unit.exponent = -3) + scale_x_wl_continuous() ggplot(yellow_gel.spct) + geom_line() + scale_y_Afr_continuous(axis.symbols = FALSE) + scale_x_wl_continuous(axis.symbols = FALSE) unset_filter_qty_default()
Afr_as_default() ggplot(yellow_gel.spct) + geom_line() + scale_y_Afr_continuous() + scale_x_wl_continuous() ggplot(yellow_gel.spct) + geom_line() + scale_y_Afr_continuous(unit.exponent = -2) + scale_x_wl_continuous() ggplot(yellow_gel.spct) + geom_line() + scale_y_Afr_continuous(unit.exponent = -3) + scale_x_wl_continuous() ggplot(yellow_gel.spct) + geom_line() + scale_y_Afr_continuous(axis.symbols = FALSE) + scale_x_wl_continuous(axis.symbols = FALSE) unset_filter_qty_default()
Scale y continuous with defaults suitable for raw detector counts.
scale_y_counts_continuous( unit.exponent = ifelse(normalized, 0, 3), name = counts_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["counts"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... ) scale_y_counts_tg_continuous( unit.exponent = ifelse(normalized, 0, 3), name = counts_label(unit.exponent = 0, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_tg_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["counts"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... )
scale_y_counts_continuous( unit.exponent = ifelse(normalized, 0, 3), name = counts_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["counts"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... ) scale_y_counts_tg_continuous( unit.exponent = ifelse(normalized, 0, 3), name = counts_label(unit.exponent = 0, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_tg_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["counts"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... )
unit.exponent |
integer |
name |
The name of the scale, used for the axis-label. |
labels |
The tick labels or a function to generate them. |
format |
character string, "R", "R.expression", "R.character", or "LaTeX". |
label.text |
character Textual portion of the labels. |
scaled |
logical If |
normalized |
logical ( |
axis.symbols |
logical If |
... |
other named arguments passed to |
This function only alters default arguments values for name
and
labels
, please, see documentation for
scale_continuous
for other parameters.
ggplot(white_led.raw_spct) + geom_line() + scale_y_counts_continuous() + scale_x_wl_continuous() ggplot(white_led.raw_spct) + geom_line() + scale_y_counts_continuous(unit.exponent = 0) + scale_x_wl_continuous() ggplot(white_led.raw_spct) + geom_line() + scale_y_counts_tg_continuous() + scale_x_wl_continuous() ggplot(white_led.raw_spct) + geom_line() + scale_y_counts_tg_continuous(unit.exponent = 0) + scale_x_wl_continuous() norm_led.raw_spct <- normalize(white_led.raw_spct[ , 1:2], norm = "max") ggplot(norm_led.raw_spct) + geom_line() + scale_y_counts_continuous(normalized = getNormalized(norm_led.raw_spct)) + scale_x_wl_continuous() ggplot(norm_led.raw_spct) + geom_line() + scale_y_counts_tg_continuous(normalized = getNormalized(norm_led.raw_spct)) + scale_x_wl_continuous()
ggplot(white_led.raw_spct) + geom_line() + scale_y_counts_continuous() + scale_x_wl_continuous() ggplot(white_led.raw_spct) + geom_line() + scale_y_counts_continuous(unit.exponent = 0) + scale_x_wl_continuous() ggplot(white_led.raw_spct) + geom_line() + scale_y_counts_tg_continuous() + scale_x_wl_continuous() ggplot(white_led.raw_spct) + geom_line() + scale_y_counts_tg_continuous(unit.exponent = 0) + scale_x_wl_continuous() norm_led.raw_spct <- normalize(white_led.raw_spct[ , 1:2], norm = "max") ggplot(norm_led.raw_spct) + geom_line() + scale_y_counts_continuous(normalized = getNormalized(norm_led.raw_spct)) + scale_x_wl_continuous() ggplot(norm_led.raw_spct) + geom_line() + scale_y_counts_tg_continuous(normalized = getNormalized(norm_led.raw_spct)) + scale_x_wl_continuous()
Scale y continuous with defaults suitable for raw detector counts.
scale_y_cps_continuous( unit.exponent = 0, name = cps_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["cps"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... )
scale_y_cps_continuous( unit.exponent = 0, name = cps_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["cps"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... )
unit.exponent |
integer |
name |
The name of the scale, used for the axis-label. |
labels |
The tick labels or a function to generate them. |
format |
character string, "R", "R.expression", "R.character", or "LaTeX". |
label.text |
character Textual portion of the labels. |
scaled |
logical If |
normalized |
logical ( |
axis.symbols |
logical If |
... |
other named arguments passed to |
This function only alters two default arguments, please, see
documentation for scale_continuous
ggplot(white_led.cps_spct) + geom_line() + scale_y_cps_continuous() + scale_x_wl_continuous() ggplot(white_led.cps_spct) + geom_line() + scale_y_cps_continuous(3) + scale_x_wl_continuous() ggplot(white_led.cps_spct * 1e-4) + geom_line() + scale_y_cps_continuous(scaled = TRUE) + scale_x_wl_continuous() norm_led.cps_spct <- normalize(white_led.cps_spct, norm = "max") ggplot(norm_led.cps_spct) + geom_line() + scale_y_cps_continuous(normalized = getNormalized(norm_led.cps_spct)) + scale_x_wl_continuous()
ggplot(white_led.cps_spct) + geom_line() + scale_y_cps_continuous() + scale_x_wl_continuous() ggplot(white_led.cps_spct) + geom_line() + scale_y_cps_continuous(3) + scale_x_wl_continuous() ggplot(white_led.cps_spct * 1e-4) + geom_line() + scale_y_cps_continuous(scaled = TRUE) + scale_x_wl_continuous() norm_led.cps_spct <- normalize(white_led.cps_spct, norm = "max") ggplot(norm_led.cps_spct) + geom_line() + scale_y_cps_continuous(normalized = getNormalized(norm_led.cps_spct)) + scale_x_wl_continuous()
Scale y continuous with defaults suitable for raw the calibration multipliers used to convert pixel response rate (counts per second) into energy irradiance units.
scale_y_multipliers_continuous( unit.exponent = 0, name = multipliers_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["e.mult"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... )
scale_y_multipliers_continuous( unit.exponent = 0, name = multipliers_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["e.mult"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... )
unit.exponent |
integer |
name |
The name of the scale, used for the axis-label. |
labels |
The tick labels or a function to generate them. |
format |
character string, "R", "R.expression", "R.character", or "LaTeX". |
label.text |
character Textual portion of the labels. |
scaled |
logical If |
normalized |
logical ( |
axis.symbols |
logical If |
... |
other named arguments passed to |
This function only alters two default arguments, please, see
documentation for scale_continuous
Scale y continuous with defaults suitable for spectral reflectance.
scale_y_Rfr_continuous( unit.exponent = ifelse(pc.out, -2, 0), name = Rfr_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols, Rfr.type = Rfr.type), labels = SI_pl_format(exponent = unit.exponent), limits = c(0, 1), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE), Rfr.type, ... ) scale_y_Rfr_specular_continuous( unit.exponent = ifelse(pc.out, -2, 0), name = Rfr_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols, Rfr.type = "specular"), labels = SI_pl_format(exponent = unit.exponent), limits = c(0, 1), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE), ... ) scale_y_Rfr_total_continuous( unit.exponent = ifelse(pc.out, -2, 0), name = Rfr_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols, Rfr.type = "total"), labels = SI_pl_format(exponent = unit.exponent), limits = c(0, 1), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE), ... )
scale_y_Rfr_continuous( unit.exponent = ifelse(pc.out, -2, 0), name = Rfr_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols, Rfr.type = Rfr.type), labels = SI_pl_format(exponent = unit.exponent), limits = c(0, 1), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE), Rfr.type, ... ) scale_y_Rfr_specular_continuous( unit.exponent = ifelse(pc.out, -2, 0), name = Rfr_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols, Rfr.type = "specular"), labels = SI_pl_format(exponent = unit.exponent), limits = c(0, 1), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE), ... ) scale_y_Rfr_total_continuous( unit.exponent = ifelse(pc.out, -2, 0), name = Rfr_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols, Rfr.type = "total"), labels = SI_pl_format(exponent = unit.exponent), limits = c(0, 1), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE), ... )
unit.exponent |
integer |
name |
The name of the scale, used for the axis-label. |
labels |
The tick labels or a function to generate them. |
limits |
One of |
format |
character string, "R", "R.expression", "R.character", or "LaTeX". |
label.text |
character Textual portion of the labels. |
scaled |
logical If |
normalized |
logical ( |
axis.symbols |
logical If |
pc.out |
logical, if TRUE use percent as default instead of fraction of one. |
Rfr.type |
character, either "total" or "spcular". |
... |
other named arguments passed to |
This function only alters two default arguments, please, see
documentation for scale_continuous
ggplot(Ler_leaf_rflt.spct) + geom_line() + scale_y_Rfr_continuous(Rfr.type = getRfrType(Ler_leaf_rflt.spct)) + scale_x_wl_continuous() ggplot(Ler_leaf_rflt.spct) + geom_line() + scale_y_Rfr_continuous(unit.exponent = -2, Rfr.type = getRfrType(Ler_leaf_rflt.spct)) + scale_x_wl_continuous() ggplot(Ler_leaf_rflt.spct) + geom_line() + scale_y_Rfr_continuous(unit.exponent = -3, Rfr.type = getRfrType(Ler_leaf_rflt.spct)) + scale_x_wl_continuous() ggplot(Ler_leaf_rflt.spct) + geom_line() + scale_y_Rfr_specular_continuous() + scale_x_wl_continuous() ggplot(Ler_leaf_rflt.spct) + geom_line() + scale_y_Rfr_specular_continuous(axis.symbols = FALSE) + scale_x_wl_continuous(axis.symbols = FALSE)
ggplot(Ler_leaf_rflt.spct) + geom_line() + scale_y_Rfr_continuous(Rfr.type = getRfrType(Ler_leaf_rflt.spct)) + scale_x_wl_continuous() ggplot(Ler_leaf_rflt.spct) + geom_line() + scale_y_Rfr_continuous(unit.exponent = -2, Rfr.type = getRfrType(Ler_leaf_rflt.spct)) + scale_x_wl_continuous() ggplot(Ler_leaf_rflt.spct) + geom_line() + scale_y_Rfr_continuous(unit.exponent = -3, Rfr.type = getRfrType(Ler_leaf_rflt.spct)) + scale_x_wl_continuous() ggplot(Ler_leaf_rflt.spct) + geom_line() + scale_y_Rfr_specular_continuous() + scale_x_wl_continuous() ggplot(Ler_leaf_rflt.spct) + geom_line() + scale_y_Rfr_specular_continuous(axis.symbols = FALSE) + scale_x_wl_continuous(axis.symbols = FALSE)
Scale y continuous with defaults suitable for raw detector counts.
scale_y_s.e.irrad_continuous( unit.exponent = 0, name = s.e.irrad_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.e.irrad"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... ) scale_y_s.q.irrad_continuous( unit.exponent = ifelse(normalized, 0, -6), name = s.q.irrad_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.q.irrad"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... ) scale_y_s.e.irrad_log10( unit.exponent = 0, name = s.e.irrad_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.e.irrad"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... ) scale_y_s.q.irrad_log10( unit.exponent = ifelse(normalized, 0, -6), name = s.q.irrad_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.q.irrad"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... )
scale_y_s.e.irrad_continuous( unit.exponent = 0, name = s.e.irrad_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.e.irrad"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... ) scale_y_s.q.irrad_continuous( unit.exponent = ifelse(normalized, 0, -6), name = s.q.irrad_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.q.irrad"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... ) scale_y_s.e.irrad_log10( unit.exponent = 0, name = s.e.irrad_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.e.irrad"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... ) scale_y_s.q.irrad_log10( unit.exponent = ifelse(normalized, 0, -6), name = s.q.irrad_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.q.irrad"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... )
unit.exponent |
integer |
name |
The name of the scale, used for the axis-label. |
labels |
The tick labels or a function to generate them. |
format |
character string, "R", "R.expression", "R.character", or "LaTeX". |
label.text |
character Textual portion of the labels. |
scaled |
logical If |
normalized |
logical ( |
axis.symbols |
logical If |
... |
other named arguments passed to |
This function only alters two default arguments, please, see
documentation for scale_continuous
ggplot(sun.spct) + geom_line() + scale_y_s.e.irrad_continuous() + scale_x_wl_continuous() ggplot(sun.spct) + geom_line() + scale_y_s.e.irrad_continuous(label.text = "") + scale_x_wl_continuous() ggplot(sun.spct) + geom_line() + scale_y_s.e.irrad_continuous(label.text = "Irradiancia spectral,") + scale_x_wl_continuous(label.text = "Longitud de onda,") ggplot(sun.spct) + geom_line() + scale_y_s.e.irrad_continuous(unit.exponent = -1) + scale_x_wl_continuous() ggplot(sun.spct, unit.out = "photon") + geom_line() + scale_y_s.q.irrad_continuous() + scale_x_wl_continuous() ggplot(clip_wl(sun.spct, c(295, NA))) + geom_line() + scale_y_s.e.irrad_log10() + scale_x_wl_continuous() ggplot(clip_wl(sun.spct, c(295, NA)), unit.out = "photon") + geom_line(na.rm = TRUE) + scale_y_s.q.irrad_log10() + scale_x_wl_continuous() photon_as_default() normalized_sun.spct <- normalize(sun.spct) ggplot(normalized_sun.spct) + geom_line(na.rm = TRUE) + scale_y_s.q.irrad_continuous(normalized = getNormalized(normalized_sun.spct)) + scale_x_wl_continuous() unset_radiation_unit_default()
ggplot(sun.spct) + geom_line() + scale_y_s.e.irrad_continuous() + scale_x_wl_continuous() ggplot(sun.spct) + geom_line() + scale_y_s.e.irrad_continuous(label.text = "") + scale_x_wl_continuous() ggplot(sun.spct) + geom_line() + scale_y_s.e.irrad_continuous(label.text = "Irradiancia spectral,") + scale_x_wl_continuous(label.text = "Longitud de onda,") ggplot(sun.spct) + geom_line() + scale_y_s.e.irrad_continuous(unit.exponent = -1) + scale_x_wl_continuous() ggplot(sun.spct, unit.out = "photon") + geom_line() + scale_y_s.q.irrad_continuous() + scale_x_wl_continuous() ggplot(clip_wl(sun.spct, c(295, NA))) + geom_line() + scale_y_s.e.irrad_log10() + scale_x_wl_continuous() ggplot(clip_wl(sun.spct, c(295, NA)), unit.out = "photon") + geom_line(na.rm = TRUE) + scale_y_s.q.irrad_log10() + scale_x_wl_continuous() photon_as_default() normalized_sun.spct <- normalize(sun.spct) ggplot(normalized_sun.spct) + geom_line(na.rm = TRUE) + scale_y_s.q.irrad_continuous(normalized = getNormalized(normalized_sun.spct)) + scale_x_wl_continuous() unset_radiation_unit_default()
Scale y continuous with defaults suitable for response and action spectra.
scale_y_s.e.response_continuous( unit.exponent = 0, name = s.e.response_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = -unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.e.response"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... ) scale_y_s.q.response_continuous( unit.exponent = 0, name = s.q.response_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = -unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.q.response"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... ) scale_y_s.e.action_continuous( unit.exponent = 0, name = s.e.action_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = -unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.e.action"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... ) scale_y_s.q.action_continuous( unit.exponent = 0, name = s.q.action_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = -unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.q.action"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... )
scale_y_s.e.response_continuous( unit.exponent = 0, name = s.e.response_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = -unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.e.response"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... ) scale_y_s.q.response_continuous( unit.exponent = 0, name = s.q.response_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = -unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.q.response"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... ) scale_y_s.e.action_continuous( unit.exponent = 0, name = s.e.action_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = -unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.e.action"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... ) scale_y_s.q.action_continuous( unit.exponent = 0, name = s.q.action_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols), labels = SI_pl_format(exponent = -unit.exponent), format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["s.q.action"]], scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), ... )
unit.exponent |
integer |
name |
The name of the scale, used for the axis-label. |
labels |
The tick labels or a function to generate them. |
format |
character string, "R", "R.expression", "R.character", or "LaTeX". |
label.text |
character Textual portion of the labels. |
scaled |
logical If |
normalized |
logical ( |
axis.symbols |
logical If |
... |
other named arguments passed to |
This function only alters two default arguments, please, see
documentation for scale_continuous
.
ggplot(ccd.spct) + geom_line() + scale_y_s.e.action_continuous() + # per joule scale_x_wl_continuous() ggplot(ccd.spct) + geom_line() + scale_y_s.e.response_continuous() + # per joule scale_x_wl_continuous() ggplot(ccd.spct) + geom_line() + scale_y_s.e.response_continuous(unit.exponent = 6) + # per mega joule scale_x_wl_continuous() ggplot(ccd.spct, unit.out = "photon") + geom_line() + scale_y_s.q.response_continuous() + # per mol scale_x_wl_continuous() ggplot(ccd.spct, unit.out = "photon") + geom_line() + scale_y_s.q.response_continuous(unit.exponent = 3) + # per 1000 moles scale_x_wl_continuous() norm_ccd.spct <- normalize(ccd.spct, norm = "max") ggplot(norm_ccd.spct) + geom_line() + scale_y_s.e.response_continuous(normalized = getNormalized(norm_ccd.spct)) + scale_x_wl_continuous() photon_as_default() norm_ccd.spct <- normalize(ccd.spct, norm = "max") ggplot(norm_ccd.spct) + geom_line() + scale_y_s.q.response_continuous(normalized = getNormalized(norm_ccd.spct)) + scale_x_wl_continuous() ggplot(norm_ccd.spct) + geom_line() + scale_y_s.q.response_continuous(unit.exponent = 2, normalized = getNormalized(norm_ccd.spct)) + scale_x_wl_continuous() unset_radiation_unit_default()
ggplot(ccd.spct) + geom_line() + scale_y_s.e.action_continuous() + # per joule scale_x_wl_continuous() ggplot(ccd.spct) + geom_line() + scale_y_s.e.response_continuous() + # per joule scale_x_wl_continuous() ggplot(ccd.spct) + geom_line() + scale_y_s.e.response_continuous(unit.exponent = 6) + # per mega joule scale_x_wl_continuous() ggplot(ccd.spct, unit.out = "photon") + geom_line() + scale_y_s.q.response_continuous() + # per mol scale_x_wl_continuous() ggplot(ccd.spct, unit.out = "photon") + geom_line() + scale_y_s.q.response_continuous(unit.exponent = 3) + # per 1000 moles scale_x_wl_continuous() norm_ccd.spct <- normalize(ccd.spct, norm = "max") ggplot(norm_ccd.spct) + geom_line() + scale_y_s.e.response_continuous(normalized = getNormalized(norm_ccd.spct)) + scale_x_wl_continuous() photon_as_default() norm_ccd.spct <- normalize(ccd.spct, norm = "max") ggplot(norm_ccd.spct) + geom_line() + scale_y_s.q.response_continuous(normalized = getNormalized(norm_ccd.spct)) + scale_x_wl_continuous() ggplot(norm_ccd.spct) + geom_line() + scale_y_s.q.response_continuous(unit.exponent = 2, normalized = getNormalized(norm_ccd.spct)) + scale_x_wl_continuous() unset_radiation_unit_default()
Scale y continuous with defaults suitable for spectral transmittance.
scale_y_Tfr_continuous( unit.exponent = ifelse(pc.out, -2, 0), name = Tfr_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols, Tfr.type = Tfr.type), labels = SI_pl_format(exponent = unit.exponent), limits = c(0, 1), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE), Tfr.type, ... ) scale_y_Tfr_internal_continuous( unit.exponent = ifelse(pc.out, -2, 0), name = Tfr_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols, Tfr.type = "internal"), labels = SI_pl_format(exponent = unit.exponent), limits = c(0, 1), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE), ... ) scale_y_Tfr_total_continuous( unit.exponent = ifelse(pc.out, -2, 0), name = Tfr_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols, Tfr.type = "total"), labels = SI_pl_format(exponent = unit.exponent), limits = c(0, 1), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE), ... )
scale_y_Tfr_continuous( unit.exponent = ifelse(pc.out, -2, 0), name = Tfr_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols, Tfr.type = Tfr.type), labels = SI_pl_format(exponent = unit.exponent), limits = c(0, 1), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE), Tfr.type, ... ) scale_y_Tfr_internal_continuous( unit.exponent = ifelse(pc.out, -2, 0), name = Tfr_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols, Tfr.type = "internal"), labels = SI_pl_format(exponent = unit.exponent), limits = c(0, 1), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE), ... ) scale_y_Tfr_total_continuous( unit.exponent = ifelse(pc.out, -2, 0), name = Tfr_label(unit.exponent = unit.exponent, format = format, label.text = label.text, scaled = scaled, normalized = round(normalized, 1), axis.symbols = axis.symbols, Tfr.type = "total"), labels = SI_pl_format(exponent = unit.exponent), limits = c(0, 1), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE), ... )
unit.exponent |
integer |
name |
The name of the scale, used for the axis-label. |
labels |
The tick labels or a function to generate them. |
limits |
One of |
format |
character string, "R", "R.expression", "R.character", or "LaTeX". |
label.text |
character Textual portion of the labels. |
scaled |
logical If |
normalized |
logical ( |
axis.symbols |
logical If |
pc.out |
logical, if TRUE use percent as default instead of fraction of one. |
Tfr.type |
character, either "total" or "internal". |
... |
other named arguments passed to |
This function only alters two default arguments, please, see
documentation for scale_continuous
Tfr_as_default() ggplot(yellow_gel.spct) + geom_line() + scale_y_Tfr_continuous(Tfr.type = getTfrType(yellow_gel.spct)) + scale_x_wl_continuous() ggplot(yellow_gel.spct) + geom_line() + scale_y_Tfr_continuous(unit.exponent = -2, Tfr.type = getTfrType(yellow_gel.spct)) + scale_x_wl_continuous() ggplot(yellow_gel.spct) + geom_line() + scale_y_Tfr_continuous(unit.exponent = -3, Tfr.type = getTfrType(yellow_gel.spct)) + scale_x_wl_continuous() ggplot(yellow_gel.spct) + geom_line() + scale_y_Tfr_total_continuous() + scale_x_wl_continuous() ggplot(yellow_gel.spct) + geom_line() + scale_y_Tfr_total_continuous(axis.symbols = FALSE) + scale_x_wl_continuous(axis.symbols = FALSE) unset_filter_qty_default()
Tfr_as_default() ggplot(yellow_gel.spct) + geom_line() + scale_y_Tfr_continuous(Tfr.type = getTfrType(yellow_gel.spct)) + scale_x_wl_continuous() ggplot(yellow_gel.spct) + geom_line() + scale_y_Tfr_continuous(unit.exponent = -2, Tfr.type = getTfrType(yellow_gel.spct)) + scale_x_wl_continuous() ggplot(yellow_gel.spct) + geom_line() + scale_y_Tfr_continuous(unit.exponent = -3, Tfr.type = getTfrType(yellow_gel.spct)) + scale_x_wl_continuous() ggplot(yellow_gel.spct) + geom_line() + scale_y_Tfr_total_continuous() + scale_x_wl_continuous() ggplot(yellow_gel.spct) + geom_line() + scale_y_Tfr_total_continuous(axis.symbols = FALSE) + scale_x_wl_continuous(axis.symbols = FALSE) unset_filter_qty_default()
Secondary axes for wavelength data in nanometres. With suitable scaling and name (axis label) for frequency, wave number, photon energy and wavelength.
sec_axis_w_number( unit.exponent = -6, label.text = axis_labels()[["w.number"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) sec_axis_w_frequency( unit.exponent = 12, label.text = axis_labels()[["freq"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) sec_axis_energy_eV( unit.exponent = 0, label.text = axis_labels()[["energy"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) sec_axis_energy_J( unit.exponent = -18, label.text = axis_labels()[["energy"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) sec_axis_wl( unit.exponent = -9, label.text = axis_labels()[["w.length"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) )
sec_axis_w_number( unit.exponent = -6, label.text = axis_labels()[["w.number"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) sec_axis_w_frequency( unit.exponent = 12, label.text = axis_labels()[["freq"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) sec_axis_energy_eV( unit.exponent = 0, label.text = axis_labels()[["energy"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) sec_axis_energy_J( unit.exponent = -18, label.text = axis_labels()[["energy"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) sec_axis_wl( unit.exponent = -9, label.text = axis_labels()[["w.length"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) )
unit.exponent |
integer The exponent on base 10 of the scale multiplier
used for the axis labels, e.g., 3 for |
label.text |
character Textual portion of the labels. |
axis.symbols |
logical If |
These secondary axis functions can be used only when the x
aesthetic is mapped to a numerical variable containing wavelength values
expressed in nanometres. They can be used to add a secondary x axis to
plots created using ggplot()
or autoplot()
.
the default text used for quantity names are most easily changed
by resetting all the defaults once as explained in
axis_labels_uk
, even if it is possible to override them
also in each call.
ggplot(sun.spct) + geom_line() + scale_x_wl_continuous(sec.axis = sec_axis_w_number()) # Secondary axes can be added to plots built with autoplot() methods autoplot(sun.spct) + scale_x_wl_continuous(sec.axis = sec_axis_w_number()) # Using 'ggplot2' scale ggplot(sun.spct) + geom_line() + scale_x_continuous(name = w_length_label(), sec.axis = sec_axis_w_number()) # change scale multipliers, SI defined ggplot(sun.spct) + geom_line() + scale_x_wl_continuous(-6, sec.axis = sec_axis_w_number(-3)) # change scale multipliers, not SI defined (best avoided) ggplot(sun.spct) + geom_line() + scale_x_wl_continuous(-8, sec.axis = sec_axis_w_number(-4)) # Change quantity name to Spanish ggplot(sun.spct) + geom_line() + scale_x_wl_continuous(label.text = "Longitud de onda,", sec.axis = sec_axis_w_frequency(label.text = "Frecuencia,")) # Frequency in secondary axis ggplot(sun.spct) + geom_line() + scale_x_wl_continuous(sec.axis = sec_axis_w_frequency()) # Energy (per photon) in atto joules ggplot(sun.spct) + geom_line() + scale_x_wl_continuous(sec.axis = sec_axis_energy_J()) # Energy (per photon) in electron volts ggplot(sun.spct) + geom_line() + scale_x_wl_continuous(sec.axis = sec_axis_energy_eV()) # Secondary axis with wavelength using a different scale factor ggplot(sun.spct) + geom_line() + scale_x_wl_continuous(sec.axis = sec_axis_wl(-6)) # Secondary axes can be added to plots built with autoplot() methods autoplot(sun.spct) + scale_x_wl_continuous(sec.axis = sec_axis_wl(-6))
ggplot(sun.spct) + geom_line() + scale_x_wl_continuous(sec.axis = sec_axis_w_number()) # Secondary axes can be added to plots built with autoplot() methods autoplot(sun.spct) + scale_x_wl_continuous(sec.axis = sec_axis_w_number()) # Using 'ggplot2' scale ggplot(sun.spct) + geom_line() + scale_x_continuous(name = w_length_label(), sec.axis = sec_axis_w_number()) # change scale multipliers, SI defined ggplot(sun.spct) + geom_line() + scale_x_wl_continuous(-6, sec.axis = sec_axis_w_number(-3)) # change scale multipliers, not SI defined (best avoided) ggplot(sun.spct) + geom_line() + scale_x_wl_continuous(-8, sec.axis = sec_axis_w_number(-4)) # Change quantity name to Spanish ggplot(sun.spct) + geom_line() + scale_x_wl_continuous(label.text = "Longitud de onda,", sec.axis = sec_axis_w_frequency(label.text = "Frecuencia,")) # Frequency in secondary axis ggplot(sun.spct) + geom_line() + scale_x_wl_continuous(sec.axis = sec_axis_w_frequency()) # Energy (per photon) in atto joules ggplot(sun.spct) + geom_line() + scale_x_wl_continuous(sec.axis = sec_axis_energy_J()) # Energy (per photon) in electron volts ggplot(sun.spct) + geom_line() + scale_x_wl_continuous(sec.axis = sec_axis_energy_eV()) # Secondary axis with wavelength using a different scale factor ggplot(sun.spct) + geom_line() + scale_x_wl_continuous(sec.axis = sec_axis_wl(-6)) # Secondary axes can be added to plots built with autoplot() methods autoplot(sun.spct) + scale_x_wl_continuous(sec.axis = sec_axis_wl(-6))
Set R options used when plotting spectra. Option
"photobiology.plot.annotations" is used as default argument to formal
parameter annotations
and option "photobiology.plot.bands" is used
as default argument to formal parameter w.band
in all the
autoplot()
methods exported from package 'ggspectra'. These
convenience functions make it easier to edit these two option which are
stored as a vector of characters strings and a list of waveband objects,
respectively.
set_annotations_default(annotations = NULL) set_w.band_default(w.band = NULL)
set_annotations_default(annotations = NULL) set_w.band_default(w.band = NULL)
annotations |
character vector Annotations to add or remove from
defaults used by the |
w.band |
a single waveband object or a list of waveband objects. |
Previous value of option "photobiology.plot.annotations", returned invisibly.
The recognized annotation names are: "summaries"
, "peaks"
,
"peak.labels"
, "valleys"
, "valley.labels"
,
"wls"
, "wls.labels"
, "colour.guide"
,
"color.guide"
, "boxes"
, "segments"
, "labels"
.
In addition, "+"
is interpreted as a request to add to the already
present default annotations, "-"
as request to remove annotations
and "="
or missing"+"
and "-"
as a request to reset
annotations to those requested. If used, "+"
, "-"
or
"="
must be the first member of a character vector, and followed by
one or more of the names given above. To simultaneously add and remove
annotations one can pass a list
containing character
vectors
each assembled as described. The vectors are applied in the order they
appear in the list. To disable all annotations pass ""
or
c("=", "")
as argument. Adding a variation of an annotation already
present, replaces the existing one automatically: e.g., adding
"peak.labels"
replaces"peaks"
if present.
metadata retrieved from object object
is
paased to ggplot2::ggtitle()
as arguments for title
,
subtitle
and caption
. The specification for the title is
passed as argument to annotations
, and consists in the keyword
title
with optional modifiers selecting the kind of metatdata to
use, separated by colons. Up to three keywords separated by colons are
accepted, and correspond to title, subtitle and caption. The recognized
keywords are: "objt"
, "class"
, "what"
, "when"
,
"where"
, "how"
, "inst.name"
, "inst.sn"
,
"comment"
and "none"
are recognized as modifiers to
"title"
; "none"
is a placeholder. Default is
"title:objt"
or no title depending on the context.
The syntax used and behaviour are the same as for the
annotations
parameter of the autoplot()
methods for spectra,
but instead of affecting a single plot, set_annotations_default()
changes the default used for subsequent calls to autoplot()
.
Other autoplot methods:
autoplot.calibration_spct()
,
autoplot.cps_spct()
,
autoplot.filter_spct()
,
autoplot.object_spct()
,
autoplot.raw_spct()
,
autoplot.reflector_spct()
,
autoplot.response_spct()
,
autoplot.source_spct()
,
autoplot.waveband()
The labels generated represent numbers rescaled to compensate for a change in unit's by a factor of ten or by a power of ten.
SI_pl_format(exponent = 0, digits = 3, ...) SI_plain(x, exponent = 0, digits = 3, ...)
SI_pl_format(exponent = 0, digits = 3, ...) SI_plain(x, exponent = 0, digits = 3, ...)
exponent |
numeric Power of 10 to use as multiplier |
digits |
number of significant digits to show |
... |
other arguments passed on to |
x |
a numeric vector to format |
a function with single parameter x, a numeric vector, that returns a character vector
SI_pl_format()(1:10) SI_pl_format()(runif(10)) SI_pl_format(exponent = 2)(runif(10)) SI_plain(1:10) SI_plain(runif(10)) SI_plain(runif(10), digits = 2)
SI_pl_format()(1:10) SI_pl_format()(runif(10)) SI_pl_format(exponent = 2)(runif(10)) SI_plain(1:10) SI_plain(runif(10)) SI_plain(runif(10), digits = 2)
The labels generated represent the same numbers, but with trailing zeros removed/added and compensated by attaching to each label an SI multiplier "prefix".
SI_tg_format(exponent = 0, digits = 3, ...) SI_tagged(x, exponent = 0, digits = 3, ...)
SI_tg_format(exponent = 0, digits = 3, ...) SI_tagged(x, exponent = 0, digits = 3, ...)
exponent |
numeric Power of 10 to use as multiplier |
digits |
number of significant digits to show |
... |
other arguments passed on to |
x |
a numeric vector to format |
a function with single parameter x, a numeric vector, that returns a character vector
If the exponent passed has no SI prefix defined, the exponent will be adjusted to match one.
SI_tg_format()(1:10) SI_tg_format()(runif(10)) SI_tg_format(exponent = 2)(runif(10)) SI_tagged(1:10) SI_tagged(runif(10)) SI_tagged(runif(10), digits = 2)
SI_tg_format()(1:10) SI_tg_format()(runif(10)) SI_tg_format(exponent = 2)(runif(10)) SI_tagged(1:10) SI_tagged(runif(10)) SI_tagged(runif(10), digits = 2)
stat_color
computes colour definitions according to human vision.
stat_color( mapping = NULL, data = NULL, geom = "point", position = "identity", ..., chroma.type = "CMF", x.colour.transform = I, na.rm = FALSE, show.legend = FALSE, inherit.aes = TRUE )
stat_color( mapping = NULL, data = NULL, geom = "point", position = "identity", ..., chroma.type = "CMF", x.colour.transform = I, na.rm = FALSE, show.legend = FALSE, inherit.aes = TRUE )
mapping |
The aesthetic mapping, usually constructed with
|
data |
A layer specific dataset - only needed if you want to override the plot defaults. |
geom |
The geometric object to use display the data |
position |
The position adjustment to use for overlapping points on this layer |
... |
other arguments passed on to |
chroma.type |
character one of "CMF" (color matching function) or "CC"
(color coordinates) or a |
x.colour.transform |
function Applied to |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
For each row in data
a colour definition is computed assuming
that after transformation with x.colour.transform()
the values in
x
are wavelengths expressed in nanometres.
The original data frame with variable wl.color
containing
colour definitions added.
color corresponding to x-value giving wavelength in nanometres.
Set by the statistic and available to geoms.
..wl.color..
..wl.color..
Required by the statistic and need to be set with aes()
.
numeric, wavelength in nanometres
numeric, a spectral quantity
color_of
, which is used internally.
Other stats functions:
stat_find_qtys()
,
stat_find_wls()
,
stat_label_peaks()
,
stat_peaks()
,
stat_spikes()
,
stat_wb_box()
,
stat_wb_column()
,
stat_wb_contribution()
,
stat_wb_hbar()
,
stat_wb_irrad()
,
stat_wb_label()
,
stat_wb_mean()
,
stat_wb_relative()
,
stat_wb_sirrad()
,
stat_wb_total()
,
stat_wl_strip()
,
stat_wl_summary()
ggplot(sun.spct) + geom_line() + stat_color() + scale_color_identity() ggplot(sun.spct) + geom_line() + stat_color(x.colour.transform = function(x) {-x}) + scale_color_identity() + scale_x_reverse() ggplot(sun.spct) + geom_line() + stat_color(x.colour.transform = function(x) {10^x}) + scale_color_identity() + scale_x_log10()
ggplot(sun.spct) + geom_line() + stat_color() + scale_color_identity() ggplot(sun.spct) + geom_line() + stat_color(x.colour.transform = function(x) {-x}) + scale_color_identity() + scale_x_reverse() ggplot(sun.spct) + geom_line() + stat_color(x.colour.transform = function(x) {10^x}) + scale_color_identity() + scale_x_log10()
stat_find_qtys
finds at which y positions values equal to an x target
are located. Axis flipping is currently not supported.
stat_find_qtys( mapping = NULL, data = NULL, geom = "point", position = "identity", ..., target = "half.maximum", interpolate = TRUE, chroma.type = "CMF", label.fmt = "%.3g", x.label.fmt = label.fmt, y.label.fmt = label.fmt, x.label.transform = I, y.label.transform = I, x.colour.transform = x.label.transform, na.rm = FALSE, show.legend = FALSE, inherit.aes = TRUE )
stat_find_qtys( mapping = NULL, data = NULL, geom = "point", position = "identity", ..., target = "half.maximum", interpolate = TRUE, chroma.type = "CMF", label.fmt = "%.3g", x.label.fmt = label.fmt, y.label.fmt = label.fmt, x.label.transform = I, y.label.transform = I, x.colour.transform = x.label.transform, na.rm = FALSE, show.legend = FALSE, inherit.aes = TRUE )
mapping |
The aesthetic mapping, usually constructed with
|
data |
A layer specific dataset - only needed if you want to override the plot defaults. |
geom |
The geometric object to use display the data |
position |
The position adjustment to use for overlapping points on this layer |
... |
other arguments passed on to |
target |
numeric value indicating the spectral quantity value for which wavelengths are to be searched and interpolated if need. The character string "half.maximum" is also accepted as argument. |
interpolate |
logical Indicating whether the nearest wavelength value
in |
chroma.type |
character one of "CMF" (color matching function) or "CC"
(color coordinates) or a |
label.fmt , x.label.fmt , y.label.fmt
|
character strings giving a format
definition for construction of character strings labels with function
|
x.label.transform , y.label.transform , x.colour.transform
|
function Applied
to |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
These stats use geom_point
by default as it is the geom most
likely to work well in almost any situation without need of tweaking. The
default aesthetics set by these stats allow their direct use with
geom_text
, geom_label
, geom_line
, geom_rug
,
geom_hline
and geom_vline
. The formatting of the labels
returned can be controlled by the user.
A data frame with one row for each match to the target subset from
the data or linearly interpolated between the two nearest values available.
As spectra are monotonic in wavelength, this statistic will never return
more than one row in data
per target value.
x-value at or nearest to the match to the target as numeric
target value or y-value nearest to the target as numeric
x-value at or nearest to the match formatted as character
target value or y-value nearest to the target formatted as character
color definition calculated by assuming that x-values are wavelengths expressed in nanometres.
Set by the statistic and available to geoms.
..x.label..
..x..
..y..
..color..
Required by the statistic and need to be set
with aes()
.
numeric, wavelength in nanometres
numeric, a spectral quantity
These stats work nicely together with geoms geom_text_repel
and
geom_label_repel
from package ggrepel
to
solve the problem of overlapping labels by displacing them. To discard
overlapping labels use check_overlap = TRUE
as argument to
geom_text
. By default the labels are character values suitable to be
plotted as is, but with a suitable label.fmt
labels suitable for
parsing by the geoms (e.g. into expressions containing greek letters or
super or subscripts) can be also easily obtained.
Other stats functions:
stat_color()
,
stat_find_wls()
,
stat_label_peaks()
,
stat_peaks()
,
stat_spikes()
,
stat_wb_box()
,
stat_wb_column()
,
stat_wb_contribution()
,
stat_wb_hbar()
,
stat_wb_irrad()
,
stat_wb_label()
,
stat_wb_mean()
,
stat_wb_relative()
,
stat_wb_sirrad()
,
stat_wb_total()
,
stat_wl_strip()
,
stat_wl_summary()
# ggplot() methods for spectral objects set a default mapping for x and y. ggplot(yellow_gel.spct) + geom_line() + stat_find_qtys(target = "half.range") ggplot(yellow_gel.spct) + geom_line() + stat_find_qtys(target = c(490, 500, 510)) ggplot(yellow_gel.spct) + geom_line() + stat_find_qtys(target = 500, geom = "point", colour = "red") + stat_find_qtys(target = 500, geom = "text", colour = "red", hjust = 1.1, label.fmt = "Tfr = %1.2f")
# ggplot() methods for spectral objects set a default mapping for x and y. ggplot(yellow_gel.spct) + geom_line() + stat_find_qtys(target = "half.range") ggplot(yellow_gel.spct) + geom_line() + stat_find_qtys(target = c(490, 500, 510)) ggplot(yellow_gel.spct) + geom_line() + stat_find_qtys(target = 500, geom = "point", colour = "red") + stat_find_qtys(target = 500, geom = "text", colour = "red", hjust = 1.1, label.fmt = "Tfr = %1.2f")
stat_find_wls
finds at which x positions values equal to a target are
located. Axis flipping is currently not supported.
stat_find_wls( mapping = NULL, data = NULL, geom = "point", position = "identity", ..., target = "half.maximum", interpolate = TRUE, chroma.type = "CMF", label.fmt = "%.3g", x.label.fmt = label.fmt, y.label.fmt = label.fmt, x.label.transform = I, y.label.transform = I, x.colour.transform = x.label.transform, na.rm = FALSE, show.legend = FALSE, inherit.aes = TRUE )
stat_find_wls( mapping = NULL, data = NULL, geom = "point", position = "identity", ..., target = "half.maximum", interpolate = TRUE, chroma.type = "CMF", label.fmt = "%.3g", x.label.fmt = label.fmt, y.label.fmt = label.fmt, x.label.transform = I, y.label.transform = I, x.colour.transform = x.label.transform, na.rm = FALSE, show.legend = FALSE, inherit.aes = TRUE )
mapping |
The aesthetic mapping, usually constructed with
|
data |
A layer specific dataset - only needed if you want to override the plot defaults. |
geom |
The geometric object to use display the data |
position |
The position adjustment to use for overlapping points on this layer |
... |
other arguments passed on to |
target |
numeric vector indicating the spectral quantity values for
which wavelengths are to be searched and interpolated if need. The
|
interpolate |
logical Indicating whether the nearest wavelength value in
|
chroma.type |
character one of "CMF" (color matching function) or "CC"
(color coordinates) or a |
label.fmt , x.label.fmt , y.label.fmt
|
character strings giving a format
definition for construction of character strings labels with function
|
x.label.transform , y.label.transform , x.colour.transform
|
function Applied
to |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
For each row in the subset of data
matching target
a colour definition is computed assuming that after transformation with
x.colour.transform()
the values in x
are wavelengths
expressed in nanometres. Labels are constructed from x
and y
values after applying to them x.label.transform
and
y.label.transform
, respectively. In most cases the
x.label.transform
is used to back-transform the values in data
to make them agree with those displayed on the axis guides.
These stats use geom_point
by default as it is a geometry likely to
work well in almost any situation. The additional default aesthetic
mappings set by these statistics allow their direct use with
geom_text
, geom_label
, geom_line
, geom_rug
,
geom_hline
and geom_vline
. The format of the labels returned
can be controlled by the user.
A data frame with one row for each match to the target subset from
the data or linearly interpolated between the two nearest values available.
As spectra are not monotonic in the spectral quantity, this statistic can
return more than one row in data
per target value.
x-value at or nearest to the match to the target as numeric
target value or y-value nearest to the target as numeric
x-value at or nearest to the match formatted as character
target value or y-value nearest to the target formatted as character
color definition calculated by assuming that x-values are wavelengths expressed in nanometres.
Set by the statistic and available to geoms.
..x.label..
..x..
..y..
..wl.color..
Required by the statistic and need to be set
with aes()
.
numeric, wavelength in nanometres
numeric, a spectral quantity
These stats work nicely together with geoms geom_text_repel
and
geom_label_repel
from package ggrepel
to
solve the problem of overlapping labels by displacing them. To discard
overlapping labels use check_overlap = TRUE
as argument to
geom_text
. By default the labels are character values suitable to be
plotted as is, but with a suitable label.fmt
labels suitable for
parsing by the geoms (e.g. into expressions containing greek letters or
super or subscripts) can be also easily obtained.
Other stats functions:
stat_color()
,
stat_find_qtys()
,
stat_label_peaks()
,
stat_peaks()
,
stat_spikes()
,
stat_wb_box()
,
stat_wb_column()
,
stat_wb_contribution()
,
stat_wb_hbar()
,
stat_wb_irrad()
,
stat_wb_label()
,
stat_wb_mean()
,
stat_wb_relative()
,
stat_wb_sirrad()
,
stat_wb_total()
,
stat_wl_strip()
,
stat_wl_summary()
# ggplot() methods for spectral objects set a default mapping for x and y. ggplot(yellow_gel.spct) + geom_line() + stat_find_wls(target = c(0.25, 0.5, 0.75)) ggplot(yellow_gel.spct) + geom_line() + stat_find_wls(target = "half.maximum", geom = "point", colour = "red") + stat_find_wls(target = "half.maximum", geom = "text", colour = "red", hjust = 1.1, label.fmt = "%3.0f nm")
# ggplot() methods for spectral objects set a default mapping for x and y. ggplot(yellow_gel.spct) + geom_line() + stat_find_wls(target = c(0.25, 0.5, 0.75)) ggplot(yellow_gel.spct) + geom_line() + stat_find_wls(target = "half.maximum", geom = "point", colour = "red") + stat_find_wls(target = "half.maximum", geom = "text", colour = "red", hjust = 1.1, label.fmt = "%3.0f nm")
stat_labels_peaks
finds at which x positions local maxima are located,
and adds labels and colors to the data without subsetting. To find local
minima, you can use stat_labels_valleys
instead. The variable
mapped to the x
aesthetic is expected to contain wavelength values
expressed in nanometres. Axis flipping is currently not supported.
stat_label_peaks( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., span = 5, ignore_threshold = 0, strict = TRUE, chroma.type = "CMF", label.fmt = "%.3g", x.label.fmt = label.fmt, y.label.fmt = label.fmt, x.label.transform = I, y.label.transform = I, x.colour.transform = x.label.transform, label.fill = "", na.rm = TRUE, show.legend = FALSE, inherit.aes = TRUE ) stat_label_valleys( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., span = 5, ignore_threshold = 0, strict = TRUE, chroma.type = "CMF", label.fmt = "%.3g", x.label.fmt = label.fmt, y.label.fmt = label.fmt, x.label.transform = I, y.label.transform = I, x.colour.transform = x.label.transform, label.fill = "", na.rm = TRUE, show.legend = FALSE, inherit.aes = TRUE )
stat_label_peaks( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., span = 5, ignore_threshold = 0, strict = TRUE, chroma.type = "CMF", label.fmt = "%.3g", x.label.fmt = label.fmt, y.label.fmt = label.fmt, x.label.transform = I, y.label.transform = I, x.colour.transform = x.label.transform, label.fill = "", na.rm = TRUE, show.legend = FALSE, inherit.aes = TRUE ) stat_label_valleys( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., span = 5, ignore_threshold = 0, strict = TRUE, chroma.type = "CMF", label.fmt = "%.3g", x.label.fmt = label.fmt, y.label.fmt = label.fmt, x.label.transform = I, y.label.transform = I, x.colour.transform = x.label.transform, label.fill = "", na.rm = TRUE, show.legend = FALSE, inherit.aes = TRUE )
mapping |
The aesthetic mapping, usually constructed with
|
data |
A layer specific dataset - only needed if you want to override the plot defaults. |
geom |
The geometric object to use display the data |
position |
The position adjustment to use for overlapping points on this layer |
... |
other arguments passed on to |
span |
a peak is defined as an element in a sequence which is greater than all other elements within a window of width span centered at that element. The default value is 5, meaning that a peak is bigger than two consequtive neighbors on each side. Default: 5. |
ignore_threshold |
numeric value between 0.0 and 1.0 indicating the size threshold below which peaks will be ignored. |
strict |
logical flag: if TRUE, an element must be strictly greater than all other values in its window to be considered a peak. Default: FALSE. |
chroma.type |
character one of "CMF" (color matching function) or "CC"
(color coordinates) or a |
label.fmt , x.label.fmt , y.label.fmt
|
character strings giving a format
definition for construction of character strings labels with function
|
x.label.transform , y.label.transform , x.colour.transform
|
function Applied
to |
label.fill |
character string to use for labels not at peaks or valleys being highlighted. |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
These statistics assemble text labels for each peak or valley and
compute the colour corresponding to the wavelength of the peaks and
valleys. Defaults work as long as the variable mapped to the x
aesthetic contains wavelengths expressed in nanometres and the plot has
an x-scale that does not apply a transformation. The three transform
parameters can be used to back-transform the values when scales apply
transformations so that peak/valley labels and axis labels match. Of
course, x.label.transform
and y.label.transform
make also
possible to scale the values in the labels.
Both statistics use geom_text
by default as it is the geom most
likely to work well in almost any situation without need of tweaking. These
statistics work best with geom_text_repel
and
geom_label_repel
from package 'ggrepel' as they are designed so that
peak or valley labels will not overlap any observation in the whole data
set. Default aesthetics set by these statistics allow their direct use with
geom_text
, geom_label
, geom_line
, geom_rug
,
geom_hline
and geom_vline
. The formatting of the labels
returned can be controlled by the user.
The original data with additional computed variables added.
x-value at a peak (or
valley) formatted as character or otherwise the
value passed to label.fill
which defaults to an
empty string (""
).
y-value at the peak (or valley) formatted as character or
otherwise the value passed to label.fill
which defaults to an
empty string (""
).
At peaks and valleys,
color definition calculated by assuming that x-values are wavelengths
expressed in nanometres, otherwise, rgb(1, 1, 1, 0)
(transparent
white).
Set by the statistic and available to geoms.
..x.label..
..x..
..y..
black_or_white(..wl.color..)
..wl.color..
Required by the statistic and need to be set
with aes()
.
numeric, wavelength in nanometres
numeric, a spectral quantity
These stats work nicely together with geoms geom_text_repel
and
geom_label_repel
from package ggrepel
to
solve the problem of overlapping labels by displacing them. To discard
overlapping labels use check_overlap = TRUE
as argument to
geom_text
. By default the labels are character values suitable to be
plotted as is, but with a suitable label.fmt
labels suitable for
parsing by the geoms (e.g. into expressions containing greek letters or
super or subscripts) can be also easily obtained.
stat_peaks
, stat_valleys
and
find_peaks
, which is used internally.
Other stats functions:
stat_color()
,
stat_find_qtys()
,
stat_find_wls()
,
stat_peaks()
,
stat_spikes()
,
stat_wb_box()
,
stat_wb_column()
,
stat_wb_contribution()
,
stat_wb_hbar()
,
stat_wb_irrad()
,
stat_wb_label()
,
stat_wb_mean()
,
stat_wb_relative()
,
stat_wb_sirrad()
,
stat_wb_total()
,
stat_wl_strip()
,
stat_wl_summary()
# ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + geom_line() + stat_label_peaks(hjust = "left", span = 31, angle = 90, color = "red") ggplot(sun.spct) + geom_line() + stat_label_valleys(hjust = "right", span = 21, angle = 90, color = "blue") # using transformed scales requires the user to pass functions as arguments ggplot(sun.spct) + geom_line() + stat_label_peaks(hjust = "left", span = 31, angle = 90, color = "red", x.label.transform = abs) + scale_x_reverse() ggplot(sun.spct) + geom_line() + stat_label_peaks(hjust = "left", span = 31, angle = 90, color = "red", x.label.transform = function(x) {10^x}) + scale_x_log10() # geom_label ggplot(sun.spct) + geom_line() + stat_peaks(span = 41, shape = 21, size = 3) + stat_label_peaks(span = 41, geom = "label", label.fmt = "%3.0f nm") + scale_fill_identity() + scale_color_identity() + expand_limits(y = c(NA, 1)) # using 'ggrepel' to avoid overlaps # too slow for CRAN checks ## Not run: library(ggrepel) ggplot(sun.spct) + geom_line() + stat_peaks(span = 41, shape = 21, size = 3) + stat_label_peaks(span = 41, geom = "label_repel", segment.colour = "red", nudge_y = 0.12, label.fmt = "%3.0f nm", max.overlaps = Inf, min.segment.length = 0) + scale_fill_identity() + scale_color_identity() + expand_limits(y = c(NA, 1)) ## End(Not run)
# ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + geom_line() + stat_label_peaks(hjust = "left", span = 31, angle = 90, color = "red") ggplot(sun.spct) + geom_line() + stat_label_valleys(hjust = "right", span = 21, angle = 90, color = "blue") # using transformed scales requires the user to pass functions as arguments ggplot(sun.spct) + geom_line() + stat_label_peaks(hjust = "left", span = 31, angle = 90, color = "red", x.label.transform = abs) + scale_x_reverse() ggplot(sun.spct) + geom_line() + stat_label_peaks(hjust = "left", span = 31, angle = 90, color = "red", x.label.transform = function(x) {10^x}) + scale_x_log10() # geom_label ggplot(sun.spct) + geom_line() + stat_peaks(span = 41, shape = 21, size = 3) + stat_label_peaks(span = 41, geom = "label", label.fmt = "%3.0f nm") + scale_fill_identity() + scale_color_identity() + expand_limits(y = c(NA, 1)) # using 'ggrepel' to avoid overlaps # too slow for CRAN checks ## Not run: library(ggrepel) ggplot(sun.spct) + geom_line() + stat_peaks(span = 41, shape = 21, size = 3) + stat_label_peaks(span = 41, geom = "label_repel", segment.colour = "red", nudge_y = 0.12, label.fmt = "%3.0f nm", max.overlaps = Inf, min.segment.length = 0) + scale_fill_identity() + scale_color_identity() + expand_limits(y = c(NA, 1)) ## End(Not run)
stat_peaks
finds at which x positions local maxima are located. If
you want find local minima, you can use stat_valleys
instead.
Axis flipping is currently not supported.
stat_peaks( mapping = NULL, data = NULL, geom = "point", position = "identity", ..., span = 5, ignore_threshold = 0.01, strict = is.null(span), refine.wl = FALSE, method = "spline", chroma.type = "CMF", label.fmt = "%.3g", x.label.fmt = label.fmt, y.label.fmt = label.fmt, x.label.transform = I, y.label.transform = I, x.colour.transform = x.label.transform, na.rm = FALSE, show.legend = FALSE, inherit.aes = TRUE ) stat_valleys( mapping = NULL, data = NULL, geom = "point", position = "identity", ..., span = 5, ignore_threshold = -0.01, strict = is.null(span), refine.wl = FALSE, method = "spline", chroma.type = "CMF", label.fmt = "%.3g", x.label.fmt = label.fmt, y.label.fmt = label.fmt, x.label.transform = I, y.label.transform = I, x.colour.transform = x.label.transform, na.rm = FALSE, show.legend = FALSE, inherit.aes = TRUE )
stat_peaks( mapping = NULL, data = NULL, geom = "point", position = "identity", ..., span = 5, ignore_threshold = 0.01, strict = is.null(span), refine.wl = FALSE, method = "spline", chroma.type = "CMF", label.fmt = "%.3g", x.label.fmt = label.fmt, y.label.fmt = label.fmt, x.label.transform = I, y.label.transform = I, x.colour.transform = x.label.transform, na.rm = FALSE, show.legend = FALSE, inherit.aes = TRUE ) stat_valleys( mapping = NULL, data = NULL, geom = "point", position = "identity", ..., span = 5, ignore_threshold = -0.01, strict = is.null(span), refine.wl = FALSE, method = "spline", chroma.type = "CMF", label.fmt = "%.3g", x.label.fmt = label.fmt, y.label.fmt = label.fmt, x.label.transform = I, y.label.transform = I, x.colour.transform = x.label.transform, na.rm = FALSE, show.legend = FALSE, inherit.aes = TRUE )
mapping |
The aesthetic mapping, usually constructed with
|
data |
A layer specific dataset - only needed if you want to override the plot defaults. |
geom |
The geometric object to use display the data |
position |
The position adjustment to use for overlapping points on this layer |
... |
other arguments passed on to |
span |
integer A peak is defined as an element in a sequence which is
greater than all other elements within a window of width |
ignore_threshold |
numeric For peaks, value between 0.0 and 1.0 indicating the relative size of peaks compared to tallest peak threshold below which peaks will be ignored, while negative values between 0.0 and -1.0 set a threshold so that the tallest peaks are ignored, instead of the shortest. For valleys, value between 0.0 and 1.0 indicating the relative depth of valleys below which valleys will be ignored, while negative values between 0.0 and -1.0 set a threshold so that the deeper valleys are ignored, instead of the shallower ones. |
strict |
logical If |
refine.wl |
logical Flag indicating if peak or valleys locations should be refined by fitting a function. |
method |
character String with the name of a method used for peak fitting. Currently only spline interpolation is implemented. |
chroma.type |
character one of "CMF" (color matching function) or "CC"
(color coordinates) or a |
label.fmt , x.label.fmt , y.label.fmt
|
character strings giving a format
definition for construction of character strings labels with function
|
x.label.transform , y.label.transform , x.colour.transform
|
function Applied
to |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
These stats use geom_point
by default as it is the geom most
likely to work well in almost any situation without need of tweaking. The
default aesthetics set by these stats allow their direct use with
geom_text
, geom_label
, geom_line
, geom_rug
,
geom_hline
and geom_vline
. The formatting of the labels
returned can be controlled by the user.
A data frame with one row for each peak (or valley) found in the data.
x-value at the peak (or valley) as numeric
y-value at the peak (or valley) as numeric
x-value at the peak (or valley) formatted as character
y-value at the peak (or valley) formatted as character
color definition calculated by assuming that x-values are wavelengths expressed in nanometres.
color definition, either "black" or "white", as needed to
ensure high contrast to wl.color
.
Set by the statistic and available to geoms.
stat(x.label)
stat(x)
stat(y)
stat(wl.color)
Required by the statistic and need to be set with aes()
.
numeric, wavelength in nanometres
numeric, a spectral quantity
These stats work nicely together with geoms
geom_text_repel
and
geom_label_repel
from package
ggrepel
to solve the problem of overlapping labels
by displacing them. To discard overlapping labels use check_overlap =
TRUE
as argument to geom_text
.
By default the labels are character values suitable to be plotted as is, but
with a suitable label.fmt
labels suitable for parsing by the geoms
(e.g. into expressions containing greek letters or super or subscripts) can
be also easily obtained.
find_peaks
, which is used internally.
Other stats functions:
stat_color()
,
stat_find_qtys()
,
stat_find_wls()
,
stat_label_peaks()
,
stat_spikes()
,
stat_wb_box()
,
stat_wb_column()
,
stat_wb_contribution()
,
stat_wb_hbar()
,
stat_wb_irrad()
,
stat_wb_label()
,
stat_wb_mean()
,
stat_wb_relative()
,
stat_wb_sirrad()
,
stat_wb_total()
,
stat_wl_strip()
,
stat_wl_summary()
# ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + geom_line() + stat_peaks() ggplot(sun.spct) + geom_line() + stat_valleys() ggplot(sun.spct) + geom_line() + stat_peaks(span = 51, geom = "point", colour = "red") + stat_peaks(span = 51, geom = "text", colour = "red", vjust = -0.4, label.fmt = "%3.2f nm") ggplot(sun.spct) + geom_line() + stat_peaks(span = 51, geom = "point", colour = "red", refine.wl = TRUE) + stat_peaks(span = 51, geom = "text", colour = "red", vjust = -0.4, label.fmt = "%3.2f nm", refine.wl = TRUE) ggplot(sun.spct) + geom_line() + stat_peaks(span = 51, geom = "point", colour = "red", refine.wl = TRUE) + stat_peaks(mapping = aes(fill = after_stat(wl.colour), color = after_stat(BW.colour)), span = 51, geom = "label", size = 3, vjust = -0.2, label.fmt = "%.3g nm", refine.wl = TRUE) + stat_valleys(span = 71, geom = "point", colour = "blue", refine.wl = TRUE) + stat_valleys(mapping = aes(fill = after_stat(wl.colour), color = after_stat(BW.colour)), span = 71, geom = "label", size = 3, vjust = 1.2, label.fmt = "%.3g nm", refine.wl = TRUE) + expand_limits(y = 0.85) + # make room for label scale_fill_identity() + scale_color_identity()
# ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + geom_line() + stat_peaks() ggplot(sun.spct) + geom_line() + stat_valleys() ggplot(sun.spct) + geom_line() + stat_peaks(span = 51, geom = "point", colour = "red") + stat_peaks(span = 51, geom = "text", colour = "red", vjust = -0.4, label.fmt = "%3.2f nm") ggplot(sun.spct) + geom_line() + stat_peaks(span = 51, geom = "point", colour = "red", refine.wl = TRUE) + stat_peaks(span = 51, geom = "text", colour = "red", vjust = -0.4, label.fmt = "%3.2f nm", refine.wl = TRUE) ggplot(sun.spct) + geom_line() + stat_peaks(span = 51, geom = "point", colour = "red", refine.wl = TRUE) + stat_peaks(mapping = aes(fill = after_stat(wl.colour), color = after_stat(BW.colour)), span = 51, geom = "label", size = 3, vjust = -0.2, label.fmt = "%.3g nm", refine.wl = TRUE) + stat_valleys(span = 71, geom = "point", colour = "blue", refine.wl = TRUE) + stat_valleys(mapping = aes(fill = after_stat(wl.colour), color = after_stat(BW.colour)), span = 71, geom = "label", size = 3, vjust = 1.2, label.fmt = "%.3g nm", refine.wl = TRUE) + expand_limits(y = 0.85) + # make room for label scale_fill_identity() + scale_color_identity()
stat_spikes
finds at which x
positions spikes are located.
Spikes can be either upwards or downwards from the baseline.
Axis flipping is currently not supported.
stat_spikes( mapping = NULL, data = NULL, geom = "point", position = "identity", ..., z.threshold = 9, max.spike.width = 8, chroma.type = "CMF", label.fmt = "%.3g", x.label.fmt = label.fmt, y.label.fmt = label.fmt, x.label.transform = I, y.label.transform = I, x.colour.transform = x.label.transform, na.rm = FALSE, show.legend = FALSE, inherit.aes = TRUE )
stat_spikes( mapping = NULL, data = NULL, geom = "point", position = "identity", ..., z.threshold = 9, max.spike.width = 8, chroma.type = "CMF", label.fmt = "%.3g", x.label.fmt = label.fmt, y.label.fmt = label.fmt, x.label.transform = I, y.label.transform = I, x.colour.transform = x.label.transform, na.rm = FALSE, show.legend = FALSE, inherit.aes = TRUE )
mapping |
The aesthetic mapping, usually constructed with
|
data |
A layer specific dataset - only needed if you want to override the plot defaults. |
geom |
The geometric object to use display the data |
position |
The position adjustment to use for overlapping points on this layer |
... |
other arguments passed on to |
z.threshold |
numeric Modified Z values larger than |
max.spike.width |
integer Wider regions with high Z values are not detected as spikes. |
chroma.type |
character one of "CMF" (color matching function) or "CC"
(color coordinates) or a |
label.fmt , x.label.fmt , y.label.fmt
|
character strings giving a format
definition for construction of character strings labels with function
|
x.label.transform , y.label.transform , x.colour.transform
|
function Applied
to |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
This stat uses geom_point
by default as it is the geom most
likely to work well in almost any situation without need of tweaking. The
default aesthetics set by this stat allows its direct use with
geom_text
, geom_label
, geom_line
, geom_rug
,
geom_hline
and geom_vline
. The formatting of the labels
returned can be controlled by the user.
A data frame with one row for each peak (or valley) found in the data.
x-value at the peak (or valley) as numeric
y-value at the peak (or valley) as numeric
x-value at the peak (or valley) formatted as character
y-value at the peak (or valley) formatted as character
color definition calculated by assuming that x-values are wavelengths expressed in nanometres.
color definition that either "black" or "white", to ensure
high contrast to wl.color
.
Set by the statistic and available to geoms.
stat(x.label)
stat(x)
stat(y)
stat(wl.color)
Required by the statistic and need to be set with aes()
.
numeric, wavelength in nanometres
numeric, a spectral quantity
This stat works nicely together with geoms
geom_text_repel
and
geom_label_repel
from package
ggrepel
to solve the problem of overlapping labels
by displacing them. To discard overlapping labels use check_overlap =
TRUE
as argument to geom_text
.
By default the labels are character values suitable to be plotted as is, but
with a suitable label.fmt
labels suitable for parsing by the geoms
(e.g. into expressions containing greek letters or super or subscripts) can
be also easily obtained.
find_spikes
, which is used internally,
for a description of the algorithm used.
Other stats functions:
stat_color()
,
stat_find_qtys()
,
stat_find_wls()
,
stat_label_peaks()
,
stat_peaks()
,
stat_wb_box()
,
stat_wb_column()
,
stat_wb_contribution()
,
stat_wb_hbar()
,
stat_wb_irrad()
,
stat_wb_label()
,
stat_wb_mean()
,
stat_wb_relative()
,
stat_wb_sirrad()
,
stat_wb_total()
,
stat_wl_strip()
,
stat_wl_summary()
# ggplot() methods for spectral objects set a default mapping for x and y. # two spurious(?) spikes ggplot(sun.spct) + geom_line() + stat_spikes(colour = "red", alpha = 0.3) # no spikes detected ggplot(sun.spct) + geom_line() + stat_spikes(colour = "red", alpha = 0.3, max.spike.width = 3, z.threshold = 12) # small noise spikes detected ggplot(white_led.raw_spct) + geom_line() + stat_spikes(colour = "red", alpha = 0.3) ggplot(white_led.raw_spct) + geom_line() + stat_spikes(colour = "red", alpha = 0.3) + stat_spikes(geom = "text", colour = "red", check_overlap = TRUE, vjust = -0.5, label.fmt = "%3.0f nm") ggplot(white_led.raw_spct, aes(w.length, counts_2)) + geom_line() + stat_spikes(colour = "red", alpha = 0.3, max.spike.width = 3, z.threshold = 12)
# ggplot() methods for spectral objects set a default mapping for x and y. # two spurious(?) spikes ggplot(sun.spct) + geom_line() + stat_spikes(colour = "red", alpha = 0.3) # no spikes detected ggplot(sun.spct) + geom_line() + stat_spikes(colour = "red", alpha = 0.3, max.spike.width = 3, z.threshold = 12) # small noise spikes detected ggplot(white_led.raw_spct) + geom_line() + stat_spikes(colour = "red", alpha = 0.3) ggplot(white_led.raw_spct) + geom_line() + stat_spikes(colour = "red", alpha = 0.3) + stat_spikes(geom = "text", colour = "red", check_overlap = TRUE, vjust = -0.5, label.fmt = "%3.0f nm") ggplot(white_led.raw_spct, aes(w.length, counts_2)) + geom_line() + stat_spikes(colour = "red", alpha = 0.3, max.spike.width = 3, z.threshold = 12)
stat_wb_box
plots boxes corresponding to wavebands, by default located
slightly above the peak of the spectrum. Sets suitable default aesthetics for
geom_rect()
. x
-scale transformations and axis
flipping are currently not supported.
stat_wb_box( mapping = NULL, data = NULL, geom = "rect", position = "identity", ..., w.band = NULL, chroma.type = "CMF", ypos.mult = 1.07, ypos.fixed = NULL, box.height = 0.06, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
stat_wb_box( mapping = NULL, data = NULL, geom = "rect", position = "identity", ..., w.band = NULL, chroma.type = "CMF", ypos.mult = 1.07, ypos.fixed = NULL, box.height = 0.06, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
mapping |
The aesthetic mapping, usually constructed with
|
data |
A layer specific dataset - only needed if you want to override the plot defaults. |
geom |
The geometric object to use display the data |
position |
The position adjustment to use for overlapping points on this layer |
... |
other arguments passed on to |
w.band |
a waveband object or a list of waveband objects or numeric vector of at least length two. |
chroma.type |
character one of "CMF" (color matching function) or "CC"
(color coordinates) or a |
ypos.mult |
numeric Multiplier constant used to compute returned
|
ypos.fixed |
numeric If not |
box.height |
numeric The height of the box as a fraction of the range of $y$. This is similar to using npc units. |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
A data frame with one row for each waveband object in the argument
to w.band
. Wavebeand outside the range of the spectral data are
trimmed or discarded.
What it is named integral below is the result of appying integral.fun
to the data, with default integrate_xy
.
w.band-midpoint
w.band minimum
w.band maximum
data$y minimum
data$y maximum
box bottom
box top
ypos.fixed or top of data, adjusted by ypos.mult
color of the w.band
label of w.band
black_or_white(wb.color)
Set by the statistic and available to geoms.
stat(wb.xmin)
stat(wb.xmax)
stat(ymin)
stat(ymax)
..wb.color..
Required by the statistic and need to be set with aes()
.
numeric, wavelength in nanometres
numeric, a spectral quantity
This stat uses a panel function and ignores grouping as it is meant to
be used for annotations. The value returned as default value for y
is based on the y-range of spectral values for the whole data set.
Other stats functions:
stat_color()
,
stat_find_qtys()
,
stat_find_wls()
,
stat_label_peaks()
,
stat_peaks()
,
stat_spikes()
,
stat_wb_column()
,
stat_wb_contribution()
,
stat_wb_hbar()
,
stat_wb_irrad()
,
stat_wb_label()
,
stat_wb_mean()
,
stat_wb_relative()
,
stat_wb_sirrad()
,
stat_wb_total()
,
stat_wl_strip()
,
stat_wl_summary()
library(photobiologyWavebands) # ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + stat_wb_box(w.band = VIS_bands()) + geom_line() + scale_fill_identity() ggplot(sun.spct) + stat_wb_box(w.band = VIS_bands(), color = "white") + geom_line() + scale_fill_identity()
library(photobiologyWavebands) # ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + stat_wb_box(w.band = VIS_bands()) + geom_line() + scale_fill_identity() ggplot(sun.spct) + stat_wb_box(w.band = VIS_bands(), color = "white") + geom_line() + scale_fill_identity()
stat_wb_column
computes means under a curve. It first integrates the
area under a spectral curve and also the mean expressed per nanaometre of
wavelength for each waveband in the input. Sets suitable default aesthetics
for geom_rect()
. x
-scale transformations and axis
flipping are currently not supported.
stat_wb_column( mapping = NULL, data = NULL, geom = "rect", position = "identity", ..., w.band = NULL, integral.fun = integrate_xy, chroma.type = "CMF", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
stat_wb_column( mapping = NULL, data = NULL, geom = "rect", position = "identity", ..., w.band = NULL, integral.fun = integrate_xy, chroma.type = "CMF", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
mapping |
The aesthetic mapping, usually constructed with
|
data |
A layer specific dataset - only needed if you want to override the plot defaults. |
geom |
The geometric object to use display the data |
position |
The position adjustment to use for overlapping points on this layer |
... |
other arguments passed on to |
w.band |
a waveband object or a list of waveband objects or numeric vector of at least length two. |
integral.fun |
function on $x$ and $y$. |
chroma.type |
character one of "CMF" (color matching function) or "CC"
(color coordinates) or a |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
A data frame with one row for each waveband object in the argument
to w.band
. Wavebeand outside the range of the spectral data are
trimmed or discarded.
What it is named integral below is the result of appying integral.fun
,
with default integrate_xy
.
w.band-midpoint
w.band minimum
w.band maximum
data$y minimum
data$y maximum
yint divided by wl_expanse(w.band)
wb.ymeam
color of the w.band
label of w.band
black_or_white(wb.color)
Set by the statistic and available to geoms.
..wb.xmin..
..wb.xmax..
0
..wb.ymean..
..wb.color..
Required by the statistic and need to be set with aes()
.
numeric, wavelength in nanometres
numeric, a spectral quantity
If the argument passed to w.band
is a BSWF it is silently
converted to a wavelength range and the average of spectral values without
weighting is returned as default value for ymax
while the default
value for ymin
is zero.
Other stats functions:
stat_color()
,
stat_find_qtys()
,
stat_find_wls()
,
stat_label_peaks()
,
stat_peaks()
,
stat_spikes()
,
stat_wb_box()
,
stat_wb_contribution()
,
stat_wb_hbar()
,
stat_wb_irrad()
,
stat_wb_label()
,
stat_wb_mean()
,
stat_wb_relative()
,
stat_wb_sirrad()
,
stat_wb_total()
,
stat_wl_strip()
,
stat_wl_summary()
library(photobiologyWavebands) # ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + stat_wb_column(w.band = VIS_bands()) + geom_line() + scale_fill_identity() ggplot(sun.spct) + stat_wb_column(w.band = VIS_bands(), alpha = 0.5) + geom_line() + scale_fill_identity()
library(photobiologyWavebands) # ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + stat_wb_column(w.band = VIS_bands()) + geom_line() + scale_fill_identity() ggplot(sun.spct) + stat_wb_column(w.band = VIS_bands(), alpha = 0.5) + geom_line() + scale_fill_identity()
stat_wb_contribution
integrates the area under a spectral curve. It
first integrates the area under the curve for each waveband and for the whole
curve and then expresses the integral for each band as a relative
contribution to the area under the whole spectral curve. Sets suitable
default aesthetics for "rect", "hline", "vline", "text" and "label" geoms
displaying "contributions" per waveband to the total of the spectral
integral. x
-scale transformations and axis flipping are
currently not supported.
stat_wb_contribution( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, integral.fun = integrate_xy, label.mult = 1, chroma.type = "CMF", label.fmt = "%1.2f", ypos.mult = 1.07, ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
stat_wb_contribution( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, integral.fun = integrate_xy, label.mult = 1, chroma.type = "CMF", label.fmt = "%1.2f", ypos.mult = 1.07, ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
mapping |
The aesthetic mapping, usually constructed with
|
data |
A layer specific dataset - only needed if you want to override the plot defaults. |
geom |
The geometric object to use display the data |
position |
The position adjustment to use for overlapping points on this layer |
... |
other arguments passed on to |
w.band |
a waveband object or a list of waveband objects or numeric vector of at least length two. |
integral.fun |
function on $x$ and $y$. |
label.mult |
numeric Scaling factor applied to y-integral values before conversion into character strings. |
chroma.type |
character one of "CMF" (color matching function) or "CC"
(color coordinates) or a |
label.fmt |
character string giving a format definition for converting
y-integral values into character strings by means of function
|
ypos.mult |
numeric Multiplier constant used to scale returned
|
ypos.fixed |
numeric If not |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
A data frame with one row for each waveband object in the argument
to w.band
. Wavebeand outside the range of the spectral data are
trimmed or discarded.
What it is named integral below is the result of appying integral.fun
to the data, with default integrate_xy
.
yint multiplied by label.mult
and formatted
according to label.fmt
w.band-midpoint
w.band minimum
w.band maximum
data$y minimum
data$y maximum
data$y integral for w.band / data$y integral for whole range of data$x
yint divided by wl_expanse(w.band)
ypos.fixed or top of data, adjusted by ypos.mult
color of the w.band
label of w.band
Set by the statistic and available to geoms.
..y.label..
..x..
..xmin..
..xmax..
..y.. - (..ymax.. - ..ymin..) * 0.03
..y.. + (..ymax.. - ..ymin..) * 0.03
..ymean..
..wb.color..
Required by the statistic and need to be set with aes()
.
numeric, wavelength in nanometres
numeric, a spectral quantity
Other stats functions:
stat_color()
,
stat_find_qtys()
,
stat_find_wls()
,
stat_label_peaks()
,
stat_peaks()
,
stat_spikes()
,
stat_wb_box()
,
stat_wb_column()
,
stat_wb_hbar()
,
stat_wb_irrad()
,
stat_wb_label()
,
stat_wb_mean()
,
stat_wb_relative()
,
stat_wb_sirrad()
,
stat_wb_total()
,
stat_wl_strip()
,
stat_wl_summary()
library(photobiologyWavebands) # ggplot() methods for spectral objects set a default mapping for x and y. # Using defaults ggplot(sun.spct) + geom_line() + stat_wb_box(w.band = VIS()) + stat_wb_contribution(w.band = VIS()) + scale_fill_identity() + scale_color_identity() # Setting position and angle of the text ggplot(sun.spct) + geom_line() + stat_wb_box(w.band = VIS_bands()) + stat_wb_contribution(w.band = VIS_bands(), angle = 90, size = 2.5) + scale_fill_identity() + scale_color_identity() # Showing percentages, i.e., using a different format for numbers ggplot(sun.spct) + geom_line() + stat_wb_box(w.band = VIS_bands()) + stat_wb_contribution(w.band = VIS_bands(), size = 2.5, label.mult = 100, label.fmt = "%3.0f%%") + scale_fill_identity() + scale_color_identity() # Including the name of the waveband, i.e., changing the mapping for label ggplot(sun.spct, range = c(NA, 410)) + geom_line() + stat_wb_box(w.band = UV_bands(), color = "white") + stat_wb_contribution(w.band = UV_bands(), size = 2.5, label.mult = 100, label.fmt = "%3.0f%%", mapping = aes(label = after_stat(paste(wb.name, y.label)))) + scale_fill_identity() + scale_color_identity()
library(photobiologyWavebands) # ggplot() methods for spectral objects set a default mapping for x and y. # Using defaults ggplot(sun.spct) + geom_line() + stat_wb_box(w.band = VIS()) + stat_wb_contribution(w.band = VIS()) + scale_fill_identity() + scale_color_identity() # Setting position and angle of the text ggplot(sun.spct) + geom_line() + stat_wb_box(w.band = VIS_bands()) + stat_wb_contribution(w.band = VIS_bands(), angle = 90, size = 2.5) + scale_fill_identity() + scale_color_identity() # Showing percentages, i.e., using a different format for numbers ggplot(sun.spct) + geom_line() + stat_wb_box(w.band = VIS_bands()) + stat_wb_contribution(w.band = VIS_bands(), size = 2.5, label.mult = 100, label.fmt = "%3.0f%%") + scale_fill_identity() + scale_color_identity() # Including the name of the waveband, i.e., changing the mapping for label ggplot(sun.spct, range = c(NA, 410)) + geom_line() + stat_wb_box(w.band = UV_bands(), color = "white") + stat_wb_contribution(w.band = UV_bands(), size = 2.5, label.mult = 100, label.fmt = "%3.0f%%", mapping = aes(label = after_stat(paste(wb.name, y.label)))) + scale_fill_identity() + scale_color_identity()
stat_wb_hbar
computes means under a curve. It first integrates the
area under a spectral curve and also the mean expressed per nanaometre of
wavelength for each waveband in the input. Sets suitable default aesthetics
for geoms "errorbarh" and "hline" from 'ggplot', and "linerangeh",
and "errorbarh" from 'ggstance'. x
-scale transformations and
axis flipping are currently not supported.
stat_wb_hbar( mapping = NULL, data = NULL, geom = "linerange", position = "identity", ..., w.band = NULL, integral.fun = integrate_xy, chroma.type = "CMF", ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
stat_wb_hbar( mapping = NULL, data = NULL, geom = "linerange", position = "identity", ..., w.band = NULL, integral.fun = integrate_xy, chroma.type = "CMF", ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
mapping |
The aesthetic mapping, usually constructed with
|
data |
A layer specific dataset - only needed if you want to override the plot defaults. |
geom |
The geometric object to use display the data |
position |
The position adjustment to use for overlapping points on this layer |
... |
other arguments passed on to |
w.band |
a waveband object or a list of waveband objects or numeric vector of at least length two. |
integral.fun |
function on $x$ and $y$. |
chroma.type |
character one of "CMF" (color matching function) or "CC"
(color coordinates) or a |
ypos.fixed |
numeric If not |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
A data frame with one row for each waveband object in the argument to
w.band
. Wavebeand outside the range of the spectral data are trimmed
or discarded.
What it is named integral below is the result of
appying integral.fun
, with default integrate_xy
.
w.band-midpoint
w.band minimum
w.band maximum
data$y minimum
data$y maximum
data$y integral for the range of w.band
yint divided by wl_expanse(w.band)
ypos.fixed or mean of data
color of the w.band
label of w.band
Set by the statistic and available to geoms.
..xmin..
..xmax..
..ymean..
(..ymax.. - ..ymin..) * 2e-2
..wb.color..
Required by the statistic and need to be set
with aes()
.
numeric, wavelength in nanometres
numeric, a spectral quantity
If the argument passed to w.band
is a BSWF it is silently
converted to a wavelength range and the average of spectral values without
any weighting is returned as default value for y
.
Other stats functions:
stat_color()
,
stat_find_qtys()
,
stat_find_wls()
,
stat_label_peaks()
,
stat_peaks()
,
stat_spikes()
,
stat_wb_box()
,
stat_wb_column()
,
stat_wb_contribution()
,
stat_wb_irrad()
,
stat_wb_label()
,
stat_wb_mean()
,
stat_wb_relative()
,
stat_wb_sirrad()
,
stat_wb_total()
,
stat_wl_strip()
,
stat_wl_summary()
library(photobiologyWavebands) # ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + geom_line() + stat_wb_hbar(w.band = VIS_bands(), size = 1) + scale_color_identity() + theme_bw() ggplot(sun.spct) + geom_line() + stat_wb_hbar(w.band = PAR(), size = 1) + scale_color_identity() + theme_bw() ggplot(sun.spct) + geom_line() + stat_wb_hbar(w.band = PAR(), size = 1, ypos.fixed = 0) + scale_color_identity() + theme_bw() ggplot(sun.spct) + geom_line() + stat_wb_hbar(w.band = CIE(), size = 1) + scale_color_identity() + theme_bw()
library(photobiologyWavebands) # ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + geom_line() + stat_wb_hbar(w.band = VIS_bands(), size = 1) + scale_color_identity() + theme_bw() ggplot(sun.spct) + geom_line() + stat_wb_hbar(w.band = PAR(), size = 1) + scale_color_identity() + theme_bw() ggplot(sun.spct) + geom_line() + stat_wb_hbar(w.band = PAR(), size = 1, ypos.fixed = 0) + scale_color_identity() + theme_bw() ggplot(sun.spct) + geom_line() + stat_wb_hbar(w.band = CIE(), size = 1) + scale_color_identity() + theme_bw()
stat_wb_irrad
integrates the area under a spectral irradiance curve,
yielding energy or photon irradiance. The range(s) of wavelengths to
integrate are set with a list of waveband
objects.
x
-scale transformations and axis flipping are currently not
supported.
stat_wb_irrad( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, time.unit, unit.in, label.qty = "total", label.mult = 1, chroma.type = "CMF", label.fmt = "%.3g", ypos.mult = 1.07, ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_wb_e_irrad( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, time.unit = "second", unit.in = "energy", label.qty = "total", label.mult = 1, chroma.type = "CMF", label.fmt = "%.3g", ypos.mult = 1.07, ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_wb_q_irrad( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, time.unit = "second", unit.in = "photon", label.qty = "total", label.mult = 1, chroma.type = "CMF", label.fmt = "%.3g", ypos.mult = 1.07, ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
stat_wb_irrad( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, time.unit, unit.in, label.qty = "total", label.mult = 1, chroma.type = "CMF", label.fmt = "%.3g", ypos.mult = 1.07, ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_wb_e_irrad( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, time.unit = "second", unit.in = "energy", label.qty = "total", label.mult = 1, chroma.type = "CMF", label.fmt = "%.3g", ypos.mult = 1.07, ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_wb_q_irrad( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, time.unit = "second", unit.in = "photon", label.qty = "total", label.mult = 1, chroma.type = "CMF", label.fmt = "%.3g", ypos.mult = 1.07, ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
mapping |
The aesthetic mapping, usually constructed with
|
data |
A layer specific dataset - only needed if you want to override the plot defaults. |
geom |
The geometric object to use display the data |
position |
The position adjustment to use for overlapping points on this layer |
... |
other arguments passed on to |
w.band |
a waveband object or a list of waveband objects or numeric vector of at least length two. |
time.unit |
character or lubridate::duration |
unit.in |
character One of "photon","quantum" or "energy" |
label.qty |
character |
label.mult |
numeric Scaling factor applied to y-integral values before conversion into character strings. |
chroma.type |
character one of "CMF" (color matching function) or "CC"
(color coordinates) or a |
label.fmt |
character string giving a format definition for converting
y-integral values into character strings by means of function
|
ypos.mult |
numeric Multiplier constant used to scale returned
|
ypos.fixed |
numeric If not |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
A data frame with one row for each waveband object in the argument
to w.band
. Wavebeand outside the range of the spectral data are
trimmed or discarded.
What it is named integral below is the result of appying irrad
,
e_irrad
or q_irrad
to the data.
yeff multiplied by label.mult
and formatted
according to label.fmt
w.band-midpoint
w.band minimum
w.band maximum
data$y minimum
data$y maximum
weighted irradiance if w.band
describes a BSWF
not weighted irradiance for the range of w.band
yint divided by wl_expanse(w.band)
ypos.fixed or top of data, adjusted by ypos.mult
color of the w.band
label of w.band
black_or_white(wb.color)
Set by the statistic and available to geoms.
..y.label..
..x..
..wb.xmin..
..wb.xmax..
..y.. - (..wb.ymax.. - ..wb.ymin..) * 0.03
..y.. + (..wb.ymax.. - ..wb.ymin..) * 0.03
..wb.ymean..
..wb.color..
Required by the statistic and need to be set with aes()
.
numeric, wavelength in nanometres
numeric, a spectral quantity
Other stats functions:
stat_color()
,
stat_find_qtys()
,
stat_find_wls()
,
stat_label_peaks()
,
stat_peaks()
,
stat_spikes()
,
stat_wb_box()
,
stat_wb_column()
,
stat_wb_contribution()
,
stat_wb_hbar()
,
stat_wb_label()
,
stat_wb_mean()
,
stat_wb_relative()
,
stat_wb_sirrad()
,
stat_wb_total()
,
stat_wl_strip()
,
stat_wl_summary()
library(photobiologyWavebands) # ggplot() methods for spectral objects set a default mapping for x and y. # using defaults for energy irradiance in W m-2 ggplot(sun.spct) + stat_wb_column(w.band = PAR(), alpha = 0.5) + stat_wb_e_irrad(w.band = PAR(), ypos.fixed = 0.32) + geom_line() + scale_fill_identity() + scale_color_identity() # using defaults for photon irradiance in umol m-2 s-1 ggplot(sun.spct, unit.out = "photon") + stat_wb_column(w.band = PAR(), alpha = 0.5) + stat_wb_q_irrad(w.band = PAR(), ypos.fixed = 1.5e-6, label.mult = 1e6) + geom_line() + scale_fill_identity() + scale_color_identity() # modify label format and position ggplot(sun.spct) + stat_wb_column(w.band = VIS_bands(), alpha = 0.7) + stat_wb_e_irrad(w.band = VIS_bands(), angle = 90, size = 3, hjust = "left", label.fmt = "%2.0f~~W~m^{-2}", parse = TRUE, ypos.fixed = 0.1) + geom_line() + scale_fill_identity() + scale_color_identity() # Changing label mapping ggplot(sun.spct) + stat_wb_column(w.band = VIS_bands(), alpha = 0.5) + stat_wb_e_irrad(w.band = VIS_bands(), label.fmt = "%.2f", angle = 90, color = "black", ypos.fixed = 0.1, hjust = "left", size = 3, mapping = aes(label = after_stat(paste(wb.name, ": ", signif(wb.yint, 3), sep = "")))) + geom_line() + scale_fill_identity() + scale_color_identity() + theme_bw()
library(photobiologyWavebands) # ggplot() methods for spectral objects set a default mapping for x and y. # using defaults for energy irradiance in W m-2 ggplot(sun.spct) + stat_wb_column(w.band = PAR(), alpha = 0.5) + stat_wb_e_irrad(w.band = PAR(), ypos.fixed = 0.32) + geom_line() + scale_fill_identity() + scale_color_identity() # using defaults for photon irradiance in umol m-2 s-1 ggplot(sun.spct, unit.out = "photon") + stat_wb_column(w.band = PAR(), alpha = 0.5) + stat_wb_q_irrad(w.band = PAR(), ypos.fixed = 1.5e-6, label.mult = 1e6) + geom_line() + scale_fill_identity() + scale_color_identity() # modify label format and position ggplot(sun.spct) + stat_wb_column(w.band = VIS_bands(), alpha = 0.7) + stat_wb_e_irrad(w.band = VIS_bands(), angle = 90, size = 3, hjust = "left", label.fmt = "%2.0f~~W~m^{-2}", parse = TRUE, ypos.fixed = 0.1) + geom_line() + scale_fill_identity() + scale_color_identity() # Changing label mapping ggplot(sun.spct) + stat_wb_column(w.band = VIS_bands(), alpha = 0.5) + stat_wb_e_irrad(w.band = VIS_bands(), label.fmt = "%.2f", angle = 90, color = "black", ypos.fixed = 0.1, hjust = "left", size = 3, mapping = aes(label = after_stat(paste(wb.name, ": ", signif(wb.yint, 3), sep = "")))) + geom_line() + scale_fill_identity() + scale_color_identity() + theme_bw()
stat_wb_label
computes the center of a waveband. Sets suitable default
aesthetics for "text" and "label" geoms displaying "boundaries" and "names"
of wavebands. x
-scale transformations and axis flipping are
currently not supported.
stat_wb_label( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, chroma.type = "CMF", label.fmt = "%s", ypos.fixed = 0, na.rm = TRUE, show.legend = NA, inherit.aes = TRUE )
stat_wb_label( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, chroma.type = "CMF", label.fmt = "%s", ypos.fixed = 0, na.rm = TRUE, show.legend = NA, inherit.aes = TRUE )
mapping |
The aesthetic mapping, usually constructed with
|
data |
A layer specific dataset - only needed if you want to override the plot defaults. |
geom |
The geometric object to use display the data |
position |
The position adjustment to use for overlapping points on this layer |
... |
other arguments passed on to |
w.band |
a waveband object or a list of waveband objects or numeric vector of at least length two. |
chroma.type |
character one of "CMF" (color matching function) or "CC"
(color coordinates) or a |
label.fmt |
character string giving a format definition for formating
the name of the waveband.
|
ypos.fixed |
numeric If not |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
A data frame with one row for each waveband object in the argument
to w.band
. Wavebeand outside the range of the spectral data are
trimmed or discarded.
w.band-midpoint
w.band minimum
w.band maximum
ypos.fixed or zero
color of the w.band
label of w.band
formatted wb.name
Set by the statistic and available to geoms.
..wb.label..
..x..
..wb.xmin..
..wb.xmax..
..wb.color..
Required by the statistic and need to be set with aes()
.
numeric, wavelength in nanometres
This stat uses a panel function and ignores grouping as it is meant to be used for annotations.
Other stats functions:
stat_color()
,
stat_find_qtys()
,
stat_find_wls()
,
stat_label_peaks()
,
stat_peaks()
,
stat_spikes()
,
stat_wb_box()
,
stat_wb_column()
,
stat_wb_contribution()
,
stat_wb_hbar()
,
stat_wb_irrad()
,
stat_wb_mean()
,
stat_wb_relative()
,
stat_wb_sirrad()
,
stat_wb_total()
,
stat_wl_strip()
,
stat_wl_summary()
library(photobiologyWavebands) # ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + geom_line() + stat_wb_box(w.band = VIS(), ymin = -0.04, ymax = 0, color = "black", fill = "white") + stat_wb_label(w.band = VIS(), ypos.fixed = -0.02, color = "black") ggplot(sun.spct) + geom_line() + stat_wb_hbar(w.band = PAR(), ypos.fixed = 0, size = 1) + stat_wb_label(aes(color = ..wb.color..), w.band = PAR(), ypos.fixed = +0.025) + scale_color_identity()
library(photobiologyWavebands) # ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + geom_line() + stat_wb_box(w.band = VIS(), ymin = -0.04, ymax = 0, color = "black", fill = "white") + stat_wb_label(w.band = VIS(), ypos.fixed = -0.02, color = "black") ggplot(sun.spct) + geom_line() + stat_wb_hbar(w.band = PAR(), ypos.fixed = 0, size = 1) + stat_wb_label(aes(color = ..wb.color..), w.band = PAR(), ypos.fixed = +0.025) + scale_color_identity()
stat_wb_mean
computes mean spectral irradiance under a curve for each
waveband in the input. Sets suitable default aesthetics for "rect", "hline",
"vline", "text" and "label" geoms. x
-scale transformations
and axis flipping are currently not supported.
stat_wb_mean( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, integral.fun = integrate_xy, label.mult = 1, chroma.type = "CMF", label.fmt = "%.3g", ypos.mult = 1.07, xpos.fixed = NULL, ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
stat_wb_mean( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, integral.fun = integrate_xy, label.mult = 1, chroma.type = "CMF", label.fmt = "%.3g", ypos.mult = 1.07, xpos.fixed = NULL, ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
mapping |
The aesthetic mapping, usually constructed with
|
data |
A layer specific dataset - only needed if you want to override the plot defaults. |
geom |
The geometric object to use display the data |
position |
The position adjustment to use for overlapping points on this layer |
... |
other arguments passed on to |
w.band |
a waveband object or a list of waveband objects or numeric vector of at least length two. |
integral.fun |
function on $x$ and $y$. |
label.mult |
numeric Scaling factor applied to y-integral values before conversion into character strings. |
chroma.type |
character one of "CMF" (color matching function) or "CC"
(color coordinates) or a |
label.fmt |
character string giving a format definition for converting
y-integral values into character strings by means of function
|
ypos.mult |
numeric Multiplier constant used to scale returned
|
xpos.fixed , ypos.fixed
|
numeric If not |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
A data frame with one row for each waveband object in the argument
to w.band
. Wavebeand outside the range of the spectral data are
trimmed or discarded.
What it is named integral below is the result of appying integral.fun
,
with default integrate_xy
.
ymean multiplied by label.mult
and formatted
according to label.fmt
w.band-midpoint
w.band minimum
w.band maximum
data$y minimum
data$y maximum
data$y integral for the range of w.band
yint divided by wl_expanse(w.band)
ypos.fixed or top of data, adjusted by ypos.mult
color of the w.band
label of w.band
black_or_white(wb.color)
Set by the statistic and available to geoms.
..y.label..
..x..
..wb.xmin..
..wb.xmax..
0
..wb.ymean..
..wb.ymean..
..wb.color..
Required by the statistic and need to be set with aes()
.
numeric, wavelength in nanometres
numeric, a spectral quantity
Other stats functions:
stat_color()
,
stat_find_qtys()
,
stat_find_wls()
,
stat_label_peaks()
,
stat_peaks()
,
stat_spikes()
,
stat_wb_box()
,
stat_wb_column()
,
stat_wb_contribution()
,
stat_wb_hbar()
,
stat_wb_irrad()
,
stat_wb_label()
,
stat_wb_relative()
,
stat_wb_sirrad()
,
stat_wb_total()
,
stat_wl_strip()
,
stat_wl_summary()
library(photobiologyWavebands) # ggplot() methods for spectral objects set a default mapping for x and y. # Using defaults ggplot(sun.spct) + stat_wb_column(w.band = VIS_bands()) + stat_wb_mean(w.band = VIS_bands(), color = "black") + scale_fill_identity() + scale_color_identity() # Setting format for numbers, position, angle, and color ggplot(sun.spct) + stat_wb_column(w.band = VIS_bands(), alpha = 0.5) + stat_wb_mean(w.band = VIS_bands(), label.fmt = "%.2f", angle = 90, color = "black", ypos.fixed = 0.1) + geom_line() + scale_fill_identity() + scale_color_identity() + theme_bw() # Changing label mapping ggplot(sun.spct) + stat_wb_column(w.band = VIS_bands(), alpha = 0.5) + stat_wb_mean(w.band = VIS_bands(), label.fmt = "%.2f", angle = 90, color = "black", ypos.fixed = 0.1, hjust = "left", size = 3, mapping = aes(label = after_stat(paste(wb.name, ": ", y.label, sep = "")))) + geom_line() + scale_fill_identity() + scale_color_identity() + theme_bw() # example using repulsion library(ggrepel) ggplot(sun.spct) + geom_line() + stat_wb_hbar(w.band = VIS_bands(), size = 1.5) + stat_wb_mean(w.band = VIS_bands(), geom = "label_repel", nudge_y = +0.04, size = 3, segment.colour = NA, label.size = NA) + expand_limits(y = 0.9) + scale_fill_identity() + scale_color_identity() + theme_bw()
library(photobiologyWavebands) # ggplot() methods for spectral objects set a default mapping for x and y. # Using defaults ggplot(sun.spct) + stat_wb_column(w.band = VIS_bands()) + stat_wb_mean(w.band = VIS_bands(), color = "black") + scale_fill_identity() + scale_color_identity() # Setting format for numbers, position, angle, and color ggplot(sun.spct) + stat_wb_column(w.band = VIS_bands(), alpha = 0.5) + stat_wb_mean(w.band = VIS_bands(), label.fmt = "%.2f", angle = 90, color = "black", ypos.fixed = 0.1) + geom_line() + scale_fill_identity() + scale_color_identity() + theme_bw() # Changing label mapping ggplot(sun.spct) + stat_wb_column(w.band = VIS_bands(), alpha = 0.5) + stat_wb_mean(w.band = VIS_bands(), label.fmt = "%.2f", angle = 90, color = "black", ypos.fixed = 0.1, hjust = "left", size = 3, mapping = aes(label = after_stat(paste(wb.name, ": ", y.label, sep = "")))) + geom_line() + scale_fill_identity() + scale_color_identity() + theme_bw() # example using repulsion library(ggrepel) ggplot(sun.spct) + geom_line() + stat_wb_hbar(w.band = VIS_bands(), size = 1.5) + stat_wb_mean(w.band = VIS_bands(), geom = "label_repel", nudge_y = +0.04, size = 3, segment.colour = NA, label.size = NA) + expand_limits(y = 0.9) + scale_fill_identity() + scale_color_identity() + theme_bw()
stat_wb_relative
computes relative-irradiances under a curve. It first
integrates the area under the spectral curve for each waveband in the input,
and expresses these irradianses relative to their sum. Sets suitable default
aesthetics for "rect", "hline", "vline", "text" and "label" geoms.
x
-scale transformations and axis flipping are currently not
supported.
stat_wb_relative( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, integral.fun = integrate_xy, label.mult = 1, chroma.type = "CMF", label.fmt = "%1.2f", ypos.mult = 1.07, ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
stat_wb_relative( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, integral.fun = integrate_xy, label.mult = 1, chroma.type = "CMF", label.fmt = "%1.2f", ypos.mult = 1.07, ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
mapping |
The aesthetic mapping, usually constructed with
|
data |
A layer specific dataset - only needed if you want to override the plot defaults. |
geom |
The geometric object to use display the data |
position |
The position adjustment to use for overlapping points on this layer |
... |
other arguments passed on to |
w.band |
a waveband object or a list of waveband objects or numeric vector of at least length two. |
integral.fun |
function on $x$ and $y$. |
label.mult |
numeric Scaling factor applied to y-integral values before conversion into character strings. |
chroma.type |
character one of "CMF" (color matching function) or "CC"
(color coordinates) or a |
label.fmt |
character string giving a format definition for converting
y-integral values into character strings by means of function
|
ypos.mult |
numeric Multiplier constant used to scale returned
|
ypos.fixed |
numeric If not |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
A data frame with one row for each waveband object in the argument
to w.band
. Wavebeand outside the range of the spectral data are
trimmed or discarded.
What it is named integral below is the result of appying integral.fun
to the data, with default integrate_xy
.
yint multiplied by label.mult
and formatted
according to label.fmt
w.band-midpoint
w.band minimum
w.band maximum
data$y minimum
data$y maximum
data$y integral for each mebmer of w.band / sum of data$y integrals for all wavebands in w.band
yint divided by wl_expanse(w.band)
ypos.fixed or top of data, adjusted by ypos.mult
color of the w.band
label of w.band
black_or_white(wb.color)
Set by the statistic and available to geoms.
..y.label..
..x..
..wb.xmin..
..wb.xmax..
..y.. - (..wb.ymax.. - ..wb.ymin..) * 0.03
..y.. + (..wb.ymax.. - ..wb.ymin..) * 0.03
..wb.ymean..
..wb.color..
Required by the statistic and need to be set with aes()
.
numeric, wavelength in nanometres
numeric, a spectral quantity
Other stats functions:
stat_color()
,
stat_find_qtys()
,
stat_find_wls()
,
stat_label_peaks()
,
stat_peaks()
,
stat_spikes()
,
stat_wb_box()
,
stat_wb_column()
,
stat_wb_contribution()
,
stat_wb_hbar()
,
stat_wb_irrad()
,
stat_wb_label()
,
stat_wb_mean()
,
stat_wb_sirrad()
,
stat_wb_total()
,
stat_wl_strip()
,
stat_wl_summary()
library(photobiologyWavebands) # ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + geom_line() + stat_wb_box(w.band = VIS()) + stat_wb_relative(w.band = VIS()) + scale_fill_identity() + scale_color_identity() ggplot(sun.spct) + geom_line() + stat_wb_box(w.band = VIS_bands()) + stat_wb_relative(w.band = VIS_bands(), angle = 90, size = 2.5) + scale_fill_identity() + scale_color_identity() ggplot(sun.spct) + geom_line() + stat_wb_box(w.band = VIS_bands()) + stat_wb_relative(w.band = VIS_bands(), angle = 90, size = 2.5, label.mult = 100, label.fmt = "%3.0f%%") + scale_fill_identity() + scale_color_identity()
library(photobiologyWavebands) # ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + geom_line() + stat_wb_box(w.band = VIS()) + stat_wb_relative(w.band = VIS()) + scale_fill_identity() + scale_color_identity() ggplot(sun.spct) + geom_line() + stat_wb_box(w.band = VIS_bands()) + stat_wb_relative(w.band = VIS_bands(), angle = 90, size = 2.5) + scale_fill_identity() + scale_color_identity() ggplot(sun.spct) + geom_line() + stat_wb_box(w.band = VIS_bands()) + stat_wb_relative(w.band = VIS_bands(), angle = 90, size = 2.5, label.mult = 100, label.fmt = "%3.0f%%") + scale_fill_identity() + scale_color_identity()
stat_wb_sirrad
computes the mean spectral irradiance under a curve,
yielding energy or photon spectral irradiance. The range(s) of wavelengths to
integrate are set with a list of waveband
objects.
x
-scale transformations and axis flipping are currently not
supported.
stat_wb_sirrad( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, time.unit, unit.in, label.qty = "mean", label.mult = 1, chroma.type = "CMF", label.fmt = "%.3g", ypos.mult = 0.55, xpos.fixed = NULL, ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_wb_e_sirrad( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, time.unit = "second", unit.in = "energy", label.qty = "mean", label.mult = 1, chroma.type = "CMF", label.fmt = "%.3g", ypos.mult = 0.55, xpos.fixed = NULL, ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_wb_q_sirrad( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, time.unit = "second", unit.in = "photon", label.qty = "mean", label.mult = 1, chroma.type = "CMF", label.fmt = "%.3g", ypos.mult = 1.07, xpos.fixed = NULL, ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
stat_wb_sirrad( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, time.unit, unit.in, label.qty = "mean", label.mult = 1, chroma.type = "CMF", label.fmt = "%.3g", ypos.mult = 0.55, xpos.fixed = NULL, ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_wb_e_sirrad( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, time.unit = "second", unit.in = "energy", label.qty = "mean", label.mult = 1, chroma.type = "CMF", label.fmt = "%.3g", ypos.mult = 0.55, xpos.fixed = NULL, ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_wb_q_sirrad( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, time.unit = "second", unit.in = "photon", label.qty = "mean", label.mult = 1, chroma.type = "CMF", label.fmt = "%.3g", ypos.mult = 1.07, xpos.fixed = NULL, ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
mapping |
The aesthetic mapping, usually constructed with
|
data |
A layer specific dataset - only needed if you want to override the plot defaults. |
geom |
The geometric object to use display the data |
position |
The position adjustment to use for overlapping points on this layer |
... |
other arguments passed on to |
w.band |
a waveband object or a list of waveband objects or numeric vector of at least length two. |
time.unit |
character or lubridate::duration |
unit.in |
character One of "photon","quantum" or "energy" |
label.qty |
character |
label.mult |
numeric Scaling factor applied to y-integral values before conversion into character strings. |
chroma.type |
character one of "CMF" (color matching function) or "CC"
(color coordinates) or a |
label.fmt |
character string giving a format definition for converting
y-integral values into character strings by means of function
|
ypos.mult |
numeric Multiplier constant used to scale returned
|
xpos.fixed , ypos.fixed
|
numeric If not |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
A data frame with one row for each waveband object in the argument
to w.band
. Wavebeand outside the range of the spectral data are
trimmed or discarded.
What it is named integral below is the result of appying irrad
,
e_irrad
or q_irrad
to the data.
yeff multiplied by label.mult
and formatted
according to label.fmt
w.band-midpoint
w.band minimum
w.band maximum
data$y minimum
data$y maximum
weighted irradiance if w.band
describes a BSWF
not weighted irradiance for the range of w.band
yint divided by wl_expanse(w.band)
ypos.fixed or top of data, adjusted by ypos.mult
color of the w.band
label of w.band
black_or_white(wb.color)
Set by the statistic and available to geoms.
..y.label..
..x..
..wb.xmin..
..wb.xmax..
0
..wb.ymean..
..wb.ymean..
..wb.color..
Required by the statistic and need to be set with aes()
.
numeric, wavelength in nanometres
numeric, a spectral quantity
Other stats functions:
stat_color()
,
stat_find_qtys()
,
stat_find_wls()
,
stat_label_peaks()
,
stat_peaks()
,
stat_spikes()
,
stat_wb_box()
,
stat_wb_column()
,
stat_wb_contribution()
,
stat_wb_hbar()
,
stat_wb_irrad()
,
stat_wb_label()
,
stat_wb_mean()
,
stat_wb_relative()
,
stat_wb_total()
,
stat_wl_strip()
,
stat_wl_summary()
library(photobiologyWavebands) # ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + stat_wb_column(w.band = VIS_bands()) + stat_wb_e_sirrad(w.band = VIS_bands(), angle = 90, size = 4, label.fmt = "%1.2f", ypos.fixed = 0.1) + geom_line() + scale_fill_identity() + scale_color_identity() ggplot(sun.spct, unit.out = "photon") + geom_line() + stat_wb_hbar(w.band = PAR(), size = 1) + stat_wb_q_sirrad(aes(color = ..wb.color..), w.band = PAR(), label.fmt = "mean = %.3g", ypos.mult = 1, xpos.fixed = 390, hjust = 1) + scale_color_identity()
library(photobiologyWavebands) # ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + stat_wb_column(w.band = VIS_bands()) + stat_wb_e_sirrad(w.band = VIS_bands(), angle = 90, size = 4, label.fmt = "%1.2f", ypos.fixed = 0.1) + geom_line() + scale_fill_identity() + scale_color_identity() ggplot(sun.spct, unit.out = "photon") + geom_line() + stat_wb_hbar(w.band = PAR(), size = 1) + stat_wb_q_sirrad(aes(color = ..wb.color..), w.band = PAR(), label.fmt = "mean = %.3g", ypos.mult = 1, xpos.fixed = 390, hjust = 1) + scale_color_identity()
stat_wb_total
computes integral under a curve. Sets suitable default
aesthetics for "rect", "hline", "vline", "text" and "label" geoms displaying
"totals" per waveband. x
-scale transformations and axis
flipping are currently not supported.
stat_wb_total( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, integral.fun = integrate_xy, label.mult = 1, chroma.type = "CMF", label.fmt = "%.3g", ypos.mult = 1.07, ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
stat_wb_total( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., w.band = NULL, integral.fun = integrate_xy, label.mult = 1, chroma.type = "CMF", label.fmt = "%.3g", ypos.mult = 1.07, ypos.fixed = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
mapping |
The aesthetic mapping, usually constructed with
|
data |
A layer specific dataset - only needed if you want to override the plot defaults. |
geom |
The geometric object to use display the data |
position |
The position adjustment to use for overlapping points on this layer |
... |
other arguments passed on to |
w.band |
a waveband object or a list of waveband objects or numeric vector of at least length two. |
integral.fun |
function on $x$ and $y$. |
label.mult |
numeric Scaling factor applied to y-integral values before conversion into character strings. |
chroma.type |
character one of "CMF" (color matching function) or "CC"
(color coordinates) or a |
label.fmt |
character string giving a format definition for converting
y-integral values into character strings by means of function
|
ypos.mult |
numeric Multiplier constant used to scale returned
|
ypos.fixed |
numeric If not |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
A data frame with one row for each waveband object in the argument
to w.band
. Wavebeand outside the range of the spectral data are
trimmed or discarded.
What it is named integral below is the result of appying integral.fun
,
with default integrate_xy
.
ymean multiplied by label.mult
and formatted
according to label.fmt
w.band-midpoint
w.band minimum
w.band maximum
data$y minimum
data$y maximum
data$y integral for the range of w.band
yint divided by wl_expanse(w.band)
ypos.fixed or top of data, adjusted by ypos.mult
color of the w.band
label of w.band
black_or_white(wb.color)
Set by the statistic and available to geoms.
..y.label..
..x..
..wb.xmin..
..wb.xmax..
..y.. - (..wb.ymax.. - ..wb.ymin..) * 0.03
..y.. + (..wb.ymax.. - ..wb.ymin..) * 0.03
..wb.ymean..
..wb.color..
Required by the statistic and need to be set with aes()
.
numeric, wavelength in nanometres
numeric, a spectral quantity
Other stats functions:
stat_color()
,
stat_find_qtys()
,
stat_find_wls()
,
stat_label_peaks()
,
stat_peaks()
,
stat_spikes()
,
stat_wb_box()
,
stat_wb_column()
,
stat_wb_contribution()
,
stat_wb_hbar()
,
stat_wb_irrad()
,
stat_wb_label()
,
stat_wb_mean()
,
stat_wb_relative()
,
stat_wb_sirrad()
,
stat_wl_strip()
,
stat_wl_summary()
library(photobiologyWavebands) # ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + geom_line() + stat_wb_box(w.band = VIS()) + stat_wb_total(w.band = VIS()) + scale_fill_identity() + scale_color_identity() ggplot(sun.spct) + geom_line() + stat_wb_box(w.band = UV_bands(), color = "white") + stat_wb_total(w.band = UV_bands()) + scale_fill_identity() + scale_color_identity()
library(photobiologyWavebands) # ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + geom_line() + stat_wb_box(w.band = VIS()) + stat_wb_total(w.band = VIS()) + scale_fill_identity() + scale_color_identity() ggplot(sun.spct) + geom_line() + stat_wb_box(w.band = UV_bands(), color = "white") + stat_wb_total(w.band = UV_bands()) + scale_fill_identity() + scale_color_identity()
stat_wl_strip
computes color definitions according to human vision and
by default plots a narrow, guide-like colour gradient strip based on
wavelength. x
-scale transformations and axis flipping are
currently not supported.
stat_wl_strip( mapping = NULL, data = NULL, geom = "rect", position = "identity", ..., w.band = NULL, length.out = 150, chroma.type = "CMF", na.rm = TRUE, show.legend = FALSE, inherit.aes = TRUE ) wl_guide( mapping = NULL, data = NULL, position = "identity", ..., chroma.type = "CMF", w.band = NULL, length.out = 150, ymin = -Inf, ymax = Inf, na.rm = FALSE, show.legend = FALSE, inherit.aes = TRUE )
stat_wl_strip( mapping = NULL, data = NULL, geom = "rect", position = "identity", ..., w.band = NULL, length.out = 150, chroma.type = "CMF", na.rm = TRUE, show.legend = FALSE, inherit.aes = TRUE ) wl_guide( mapping = NULL, data = NULL, position = "identity", ..., chroma.type = "CMF", w.band = NULL, length.out = 150, ymin = -Inf, ymax = Inf, na.rm = FALSE, show.legend = FALSE, inherit.aes = TRUE )
mapping |
The aesthetic mapping, usually constructed with
|
data |
A layer specific dataset - only needed if you want to override the plot defaults. |
geom |
The geometric object to use display the data. |
position |
The position adjustment to use for overlapping points on this layer. |
... |
other arguments passed on to |
w.band |
waveband object or a list of such objects or NULL. |
length.out |
The number of steps to use to simulate a continuous range of colours when w.band == NULL. |
chroma.type |
character one of "CMF" (color matching function) or "CC"
(color coordinates) or a |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
ymin , ymax
|
numeric used as aesthetics for plotting the guide. |
generic_spect object with new x
values plus other computed
variables described below.
(w.low + wl.high) / 2
boundary of waveband
boundary of waveband
color corresponding to wavelength
color corresponding to waveband
label of w.band
Set by the statistic and available to geoms.
..x..
as.character(..wb.f..)
..wl.low..
..wl.high..
..wb.color..
Required by the statistic and need to be set with aes()
.
numeric, wavelength in nanometres
This stat uses a panel function and ignores grouping as it is meant to be used for annotations.
color_of
, which is used internally.
Other stats functions:
stat_color()
,
stat_find_qtys()
,
stat_find_wls()
,
stat_label_peaks()
,
stat_peaks()
,
stat_spikes()
,
stat_wb_box()
,
stat_wb_column()
,
stat_wb_contribution()
,
stat_wb_hbar()
,
stat_wb_irrad()
,
stat_wb_label()
,
stat_wb_mean()
,
stat_wb_relative()
,
stat_wb_sirrad()
,
stat_wb_total()
,
stat_wl_summary()
# ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + geom_line() + stat_wl_strip(ymax = -0.02, ymin = -0.04) + scale_fill_identity() # on some graphic devices the output may show spurious vertical lines ggplot(sun.spct) + wl_guide(alpha = 0.33, color = NA) + geom_line()
# ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + geom_line() + stat_wl_strip(ymax = -0.02, ymin = -0.04) + scale_fill_identity() # on some graphic devices the output may show spurious vertical lines ggplot(sun.spct) + wl_guide(alpha = 0.33, color = NA) + geom_line()
stat_wl_summary
computes the area under a curve.
stat_wl_summary( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., range = NULL, integral.fun = integrate_xy, label.fmt = "%.3g", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
stat_wl_summary( mapping = NULL, data = NULL, geom = "text", position = "identity", ..., range = NULL, integral.fun = integrate_xy, label.fmt = "%.3g", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
mapping |
The aesthetic mapping, usually constructed with
|
data |
A layer specific dataset - only needed if you want to override the plot defaults. |
geom |
The geometric object to use display the data |
position |
The position adjustment to use for overlapping points on this layer |
... |
other arguments passed on to |
range |
a numeric vector of at least length two. |
integral.fun |
function on $x$ and $y$. |
label.fmt |
character string giving a format definition for converting
y-integral values into character strings by means of function |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
A data frame with one row.
What it is named integral below is the result of appying integral.fun
,
with default integrate_xy
.
y formatted according to label.fmt
range-midpoint
range minimum
range maximum
data$y integral for the range by the expanse of the range
Set by the statistic and available to geoms.
..label..
..x..
..wb.xmin..
..wb.xmax..
..y..
0
..y..
..y..
Required by the statistic and need to be set with aes()
.
numeric, wavelength in nanometres
numeric, a spectral quantity
Other stats functions:
stat_color()
,
stat_find_qtys()
,
stat_find_wls()
,
stat_label_peaks()
,
stat_peaks()
,
stat_spikes()
,
stat_wb_box()
,
stat_wb_column()
,
stat_wb_contribution()
,
stat_wb_hbar()
,
stat_wb_irrad()
,
stat_wb_label()
,
stat_wb_mean()
,
stat_wb_relative()
,
stat_wb_sirrad()
,
stat_wb_total()
,
stat_wl_strip()
# ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + geom_line() + stat_wl_summary(geom = "hline") ggplot(sun.spct) + geom_line() + stat_wl_summary(label.fmt = "mean = %.3f", color = "red", vjust = -0.3) + stat_wl_summary(geom = "hline", color = "red")
# ggplot() methods for spectral objects set a default mapping for x and y. ggplot(sun.spct) + geom_line() + stat_wl_summary(geom = "hline") ggplot(sun.spct) + geom_line() + stat_wl_summary(label.fmt = "mean = %.3f", color = "red", vjust = -0.3) + stat_wl_summary(geom = "hline", color = "red")
Generate cps axis labels in SI units, using SI scale factors. Output can be selected as character, expression (R default devices) or LaTeX (for tikz device).
Tfr_label( unit.exponent = ifelse(pc.out, -2, 0), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE), Tfr.type ) Tfr_internal_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) Tfr_total_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) )
Tfr_label( unit.exponent = ifelse(pc.out, -2, 0), format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE), pc.out = getOption("ggspectra.pc.out", default = FALSE), Tfr.type ) Tfr_internal_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) Tfr_total_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = NULL, scaled = FALSE, normalized = FALSE, axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) )
unit.exponent |
integer |
format |
character string, "R", "R.expresion", "R.character", or "LaTeX". |
label.text |
character Textual portion of the labels. |
scaled |
logical If |
normalized |
logical ( |
axis.symbols |
logical If |
pc.out |
logical, if TRUE use percent as default instead of fraction of one. |
Tfr.type |
character, either "total" or "internal". |
a character string or an R expression.
Default for label.text
depends on the value passed as argument
to Tfr.type
.
Tfr_label(Tfr.type = "internal") Tfr_label(Tfr.type = "total") Tfr_label(Tfr.type = "internal", axis.symbols = FALSE) Tfr_internal_label() Tfr_internal_label(format = "R.expression", axis.symbols = FALSE) Tfr_internal_label(-2) Tfr_internal_label(-3) Tfr_internal_label(format = "R.expression") Tfr_internal_label(format = "LaTeX") Tfr_internal_label(-3, format = "LaTeX") Tfr_total_label() Tfr_total_label(format = "R.expression", axis.symbols = FALSE) Tfr_total_label(-2) Tfr_total_label(-3) Tfr_total_label(format = "R.expression") Tfr_total_label(format = "LaTeX") Tfr_total_label(-3, format = "LaTeX")
Tfr_label(Tfr.type = "internal") Tfr_label(Tfr.type = "total") Tfr_label(Tfr.type = "internal", axis.symbols = FALSE) Tfr_internal_label() Tfr_internal_label(format = "R.expression", axis.symbols = FALSE) Tfr_internal_label(-2) Tfr_internal_label(-3) Tfr_internal_label(format = "R.expression") Tfr_internal_label(format = "LaTeX") Tfr_internal_label(-3, format = "LaTeX") Tfr_total_label() Tfr_total_label(format = "R.expression", axis.symbols = FALSE) Tfr_total_label(-2) Tfr_total_label(-3) Tfr_total_label(format = "R.expression") Tfr_total_label(format = "LaTeX") Tfr_total_label(-3, format = "LaTeX")
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).
w_length_label( unit.exponent = -9, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["w.length"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) w_number_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["w.number"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) w_frequency_label( unit.exponent = 9, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["freq"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) w_energy_eV_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["energy"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) w_energy_J_label( unit.exponent = -18, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["energy"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) )
w_length_label( unit.exponent = -9, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["w.length"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) w_number_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["w.number"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) w_frequency_label( unit.exponent = 9, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["freq"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) w_energy_eV_label( unit.exponent = 0, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["energy"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) ) w_energy_J_label( unit.exponent = -18, format = getOption("photobiology.math", default = "R.expression"), label.text = axis_labels()[["energy"]], axis.symbols = getOption("ggspectra.axis.symbols", default = TRUE) )
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. |
axis.symbols |
logical If |
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.
a character string or an R expression.
w_length_label() w_length_label(axis.symbols = FALSE) w_length_label(format = "R.expression") w_length_label(format = "LaTeX") w_number_label() w_number_label(format = "R.expression") w_frequency_label() w_frequency_label(format = "R.expression") w_energy_J_label() w_energy_eV_label()
w_length_label() w_length_label(axis.symbols = FALSE) w_length_label(format = "R.expression") w_length_label(format = "LaTeX") w_number_label() w_number_label(format = "R.expression") w_frequency_label() w_frequency_label(format = "R.expression") w_energy_J_label() w_energy_eV_label()
To convert wavelength into wavenumber or into frequency, please, use the
conversion functions from package 'photobiology' in place of the deprecated
functions w_number()
and w_frequency()
from this package.
w_number(w.length, unit.exponent = 0) w_frequency(w.length, unit.exponent = 0)
w_number(w.length, unit.exponent = 0) w_frequency(w.length, unit.exponent = 0)
w.length |
numeric wavelength (nm) |
unit.exponent |
integer Exponent of the scale multiplier implicit in result, e.g., use 3 for kJ. |
These functions will be removed from package 'ggpmisc' in the near future.
See wl2wavenumber
for the functions to
be used in all new code.
library(photobiology) wl2wavenumber(600) wl2frequency(600)
library(photobiology) wl2wavenumber(600) wl2frequency(600)