ggplot()
initializes a ggplot object. It can be used to
declare the input spectra 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 spectra
ggplot(
data,
mapping = NULL,
...,
wl = NULL,
w.unit = "nm",
environment = parent.frame()
)
Default spectra database to use for plot. If not a spectra database, the
methods used will be those defined in package ggplot2
. See ggplot
.
If not specified, must be supplied in each layer added to the plot.
Default list of aesthetic mappings to use for plot. If not specified, in the case of spectra objects, a default mapping will be used.
Other arguments passed on to methods. Not currently used.
numeric The wavelength vector.
character The wavelength unit of the spectra.
If an 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 ggplot()
is called.
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.
?ggpmisc::ggplot()
library(visa)
library(ggplot2)
ggplot.spectra(NSpec.DF)
Run the code above in your browser using DataLab