Learn R Programming

visa (version 1.0.0)

plt.3dcm_best: Create a 3D Slice Plot of Correlation Array

Description

This function creates an interactive Plotly 3D slice plot from a 3D correlation array. The function uses the array's dimnames to define the coordinate values. If no dimnames are present, a warning is issued and sequential indices are used. The plot displays three surfaces corresponding to slices along each dimension (i, j, k) at the best band combination (where the correlation value is maximal).

Usage

plt.3dcm_best(R3, colorscale = "Spectral")

Value

An interactive Plotly figure showing three surfaces corresponding to constant slices along dimensions i, j, and k.

Arguments

R3

A 3D numeric array of correlation coefficients.

colorscale

A character string specifying the colorscale to use. If "Spectral", a custom colorscale is created using colorRampPalette(rev(RColorBrewer::brewer.pal(11, "Spectral")), space = "Lab")(100). Otherwise, the provided value is used (default is "Spectral").

Details

The function first checks if the input 3D array has proper dimnames. If not, it issues a warning and assigns sequential indices as dimnames. It then melts the array to find the best band combination based on the maximum correlation value. Using the dimnames, it finds the numeric indices for the best bands and creates grid matrices for each slice. A custom colorscale is built when colorscale = "Spectral", and the Plotly figure is constructed with a single color bar.

Examples

Run this code
if (FALSE) {
  # Assume cm3d is a 3D correlation array with proper dimnames.
  plt.3dcm_best(cm3d)
}

Run the code above in your browser using DataLab