Plot similarity matrix with pheatmap
plotSimilarityMatrix2( X, y = NULL, clusLabels = NULL, colX = NULL, colY = NULL, myLegend = NULL, fileName = "posteriorSimilarityMatrix.pdf", save = FALSE, semiSupervised = FALSE, scale = "none", showObsNames = FALSE, clr = FALSE, clc = FALSE, plotWidth = 500, plotHeight = 450 )
X | Similarity matrix. |
---|---|
y | Vector |
clusLabels | Cluster labels |
colX | Colours for the matrix |
colY | Colours for the response |
myLegend | Vector of strings with the names of the variables |
fileName | Name of pdf file |
save | Boolean flag: if TRUE, the plot is saved as a png file. |
semiSupervised | Boolean flag: if TRUE, the response is plotted next to the matrix. |
scale | Used as input for the parameter "scale" of the gplot::heatmap.2() function. Can be either "none" or "columns". |
showObsNames | Boolean. If TRUE, observation names are shown in the plot. Default is FALSE. |
clr | Boolean. If TRUE, rows are ordered by hierarchical clustering. Default is FALSE. |
clc | Boolean. If TRUE, columns are ordered by hierarchical clustering. Default is FALSE. |
plotWidth | Plot width. Default is 500. |
plotHeight | Plot height. Default is 450. |
# Load one dataset with 300 observations, 2 variables, 6 clusters data <- as.matrix(read.csv(system.file("extdata", "dataset1.csv", package = "klic"), row.names = 1)) cluster_labels <- as.matrix(read.csv(system.file("extdata", "cluster_labels.csv", package = "klic"), row.names = 1)) # Compute consensus clustering with K=6 clusters cm <- coca::consensusCluster(data, 6) # Plot consensus (similarity) matrix plotSimilarityMatrix2(cm)# Plot consensus (similarity) matrix with response names(cluster_labels) <- as.character(1:300) rownames(cm) <- names(cluster_labels) plotSimilarityMatrix2(cm, y = cluster_labels)