% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/nmfkc.R
\name{nmfkc.residual.plot}
\alias{nmfkc.residual.plot}
\title{Plot Diagnostics: Original, Fitted, and Residual Matrices as Heatmaps}
\usage{
nmfkc.residual.plot(
  Y,
  result,
  fitted.palette = (grDevices::colorRampPalette(c("white", "orange", "red")))(256),
  residual.palette = (grDevices::colorRampPalette(c("blue", "white", "red")))(256),
  ...
)
}
\arguments{
\item{Y}{The original observation matrix (P x N).}

\item{result}{The result object returned by the nmfkc function.}

\item{fitted.palette}{A vector of colors for Y and XB heatmaps. Defaults to white-orange-red.
For backward compatibility, \code{Y_XB_palette} is accepted via \code{...}.}

\item{residual.palette}{A vector of colors for the residuals heatmap. Defaults to blue-white-red.
For backward compatibility, \code{E_palette} is accepted via \code{...}.}

\item{...}{Additional graphical parameters passed to the internal image calls.}
}
\value{
NULL. The function generates a plot.
}
\description{
This 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.
}
\examples{
Y <- t(iris[1:30, 1:4])
result <- nmfkc(Y, rank = 2)
nmfkc.residual.plot(Y, result)

}
\seealso{
\code{\link{nmfkc}}, \code{\link{residuals.nmf}}
}
