Plot Diagnostics: Original, Fitted, and Residual Matrices as Heatmaps
Source:R/nmfkc.R
nmfkc.residual.plot.RdThis function generates a side-by-side plot of three heatmaps: the original observation matrix Y, the fitted matrix XB (from NMF), and the residual matrix E (Y - XB). This visualization aids in diagnosing whether the chosen rank Q is adequate by assessing if the residual matrix E appears to be random noise.
The axis labels (X-axis: Samples, Y-axis: Features) are integrated into the main title of each plot to maximize the plot area, reflecting the compact layout settings.
Usage
nmfkc.residual.plot(
Y,
result,
Y_XB_palette = (grDevices::colorRampPalette(c("white", "orange", "red")))(256),
E_palette = (grDevices::colorRampPalette(c("blue", "white", "red")))(256),
...
)Arguments
- Y
The original observation matrix (P x N).
- result
The result object returned by the nmfkc function.
- Y_XB_palette
A vector of colors used for Y and XB heatmaps. Defaults to a white-orange-red gradient.
- E_palette
A vector of colors used for the residuals (E) heatmap. Defaults to a blue-white-red gradient.
- ...
Additional graphical parameters passed to the internal image calls.