% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot.R
\name{plot_heatmap}
\alias{plot_heatmap}
\title{Coefficient Heatmap for orthoMTL}
\usage{
plot_heatmap(x, reorder = TRUE)
}
\arguments{
\item{x}{Either a fitted \code{"orthoMTL"} object or a numeric
coefficient matrix with dimensions \code{p x numTasks}. If an
\code{"orthoMTL"} object, coefficients are extracted via
\code{coef()}.}

\item{reorder}{Logical. If \code{TRUE} (default), rows are sorted
by mean coefficient across tasks (ascending).}
}
\value{
A \code{ggplot2} object.
}
\description{
Displays the coefficient matrix as a heatmap. Features (rows) can
optionally be reordered by their mean coefficient across tasks.
}
\examples{
set.seed(42)
n <- 100; p <- 10; n_tasks <- 3
X <- matrix(rnorm(n * p), n, p)
colnames(X) <- paste0("V", seq_len(p))
Y <- X \%*\% matrix(rnorm(p * n_tasks), p) + matrix(rnorm(n * n_tasks), n) * 0.1
colnames(Y) <- c("T1", "T2", "T3")
K <- matrix(1, n_tasks, n_tasks); diag(K) <- 0.5
fit <- orthoMTL(X, Y, lambda = 1e-3, K = K)

# From fitted object
plot_heatmap(fit)

# From raw matrix
plot_heatmap(coef(fit), reorder = FALSE)
}
\seealso{
\code{\link{coef.orthoMTL}}, \code{\link{plot_correlation}}
}
