plt.2dcm {visa} | R Documentation |
Create a ggplot Plot from a 2D Correlation Matrix
Description
This function creates a ggplot visualization from a 2D correlation matrix,
such as those produced by cm.sr
or cm.nsr
. The function attempts
to extract numeric wavelengths from the column names. If the extraction fails,
sequential indices are used.
Usage
plt.2dcm(
data,
mapping = NULL,
...,
show.stat = TRUE,
environment = parent.frame()
)
Arguments
data |
A numeric 2D matrix of correlation coefficients. |
mapping |
Optional ggplot2 aesthetic mapping. |
... |
Additional arguments passed to |
show.stat |
Logical. If |
environment |
The environment in which to evaluate the plot. Defaults to |
Details
It replaces the former ggplot.cm()
.
The function extracts numeric wavelengths from the column names of data
.
If these cannot be determined, sequential indices are used instead.
Value
A ggplot object visualizing the correlation matrix.
Examples
## Not run:
library(visa)
data(NSpec.DF)
x <- NSpec.DF$N # nitrogen
S <- NSpec.DF$spectra[, seq(1, ncol(NSpec.DF$spectra), 10)] # resampled to 10 nm steps
cm2d <- cm.sr(S, x, cm.plot = FALSE)
p2d <- plt.2dcm(cm2d)
print(p2d)
## End(Not run)
[Package visa version 1.0.0 Index]