R/SilhouettePlot.R

Defines functions SilhouettePlot

Documented in SilhouettePlot

# Silhouette plot
SilhouettePlot <- function(fit,cluster.col=NULL){
  distance <- 1-fit$consensus
  if (is.null(cluster.col)) cluster.col <- c("gray",2:length(unique(fit$clusters)))
  if (length(unique(fit$clusters))!=length(cluster.col)) stop("Specified number of colors didn't match with number of clusters")
  plot(silhouette(fit$clusters,dmatrix=distance),col=cluster.col,main="Silhouette plot")
  print(summary(silhouette(fit$clusters,dmatrix=distance)))
  cat("------------------------------------------------\n")
  cat("Mean silhouette width = ",mean((silhouette(fit$clusters,dmatrix=distance))[,3]),"\n")
}

Try the IntNMF package in your browser

Any scripts or data that you put into this service are public.

IntNMF documentation built on May 1, 2019, 6:35 p.m.