% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/manuscript-viz.R
\name{cluster_k_sweep}
\alias{cluster_k_sweep}
\title{Show the clustering at every k (see how it deteriorates)}
\usage{
cluster_k_sweep(
  x,
  k_range = 2:6,
  linkage = "ward.D2",
  embed = c("pca", "umap", "tsne"),
  ncol = 3
)
}
\arguments{
\item{x}{A fitted result (\code{$DistM}), a dissimilarity, or a \code{List}.}

\item{k_range}{Candidate cluster counts to display.}

\item{linkage}{Agglomeration method used to cut the fused dissimilarity.}

\item{embed}{Embedding for the (fixed) 2-D coordinates: \code{"pca"} (default),
\code{"umap"} or \code{"tsne"}.}

\item{ncol}{Columns in the panel grid.}
}
\value{
Invisibly a named numeric vector of the average silhouette per \eqn{k}.
}
\description{
Rather than only reporting the best \eqn{k}, project the objects to a
\emph{fixed} 2-D embedding and recolour them by the \eqn{k}-cut for each
candidate \eqn{k} in a grid, annotating the average silhouette per panel. This
makes it visible how the structure splits and degrades as \eqn{k} grows.
}
\examples{
data(mosaic_toy)
fit <- M_ABCpp(mosaic_toy$List, numsim = 40, NC = 3)
cluster_k_sweep(fit, k_range = 2:6)
}
\seealso{
\code{\link{cluster_selection_plot}}, \code{\link{embedding_plot}}
}
