Draws the joint distribution of input values and spectral coordinates as an exact two-dimensional histogram. A binned mean and binned 5–95% pixel envelope are calculated from the retained histogram counts.
Arguments
- cube
An
hsi_cube(from hyperspectR) or a 3-D array with dimensions(rows, cols, bands), of integer or double values. Optionalwavelengthsmetadata must be finite, unique and strictly increasing in nm. Without it, coordinates are band indices. An optional logical spatialmaskhas dimensions(rows, cols)and no missing entries;FALSEexcludes a pixel. Arrays may carry these as attributes; anhsi_cubemay carry them as list fields. Nonfinite observations are excluded.- nbins
Number of value bins. Must be an integer of at least two. Default
128.- limits
Numeric length-two value range to bin over.
NULL(default) uses the 0.1st and 99.9th percentiles of all finite eligible values.- transform
Display transform:
"log1p"(default) or"identity". Legend labels are returned to raw counts or shares.- normalise
"none"(default) displays raw counts;"band"displays shares of the retained count in each band. Empty bands remain missing.- palette
Palette name passed to
hsa_palette().- show_limits
Logical. Draw global raw eligible-value percentiles using
probs. These references include finite observations outsidelimitsand are separate from image enhancement limits. DefaultFALSE.- probs
Two increasing finite probabilities between zero and one for the global raw eligible-value references when
show_limits = TRUE. These do not set the histogram range or image enhancement limits.- value_label
A truthful label for the input values. Default
"input value". A reflectance label requires known upstream calibration; numeric range alone cannot establish calibration.
Details
Values outside limits are dropped rather than clipped into the end bins.
Masks and nonfinite values are excluded. The overlay describes the retained
pixel distribution; it is not a confidence interval.
Examples
cube <- hsa_demo_cube()
hsa_spectral_density(cube)