plotSim | R Documentation |
Heatmap of the (dis)similarity matrix
plotSim(
mat,
type = c("similarity", "dissimilarity"),
clustering = NULL,
dendro = NULL,
k = NULL,
log = TRUE,
legendName = "intensity",
main = NULL,
priorCount = 0.5,
stats = c("R.squared", "D.prime"),
h = NULL,
axis = FALSE,
naxis = min(10, nrow(mat)),
axistext = NULL,
xlab = "objects",
cluster_col = "darkred",
mode = c("standard", "corrected", "total-disp", "within-disp", "average-disp")
)
mat |
matrix to plot. It can be of class |
type |
input matrix type. Can be either |
clustering |
vector of clusters to display on the matrix (if not
|
dendro |
dendrogram provided as an |
k |
number of clusters to display. Used only when |
log |
logical. Should the breaks be based on log-scaled values of the
matrix entries. Default to |
legendName |
character. Title of the legend. Default to
|
main |
character. Title of the plot. Default to |
priorCount |
numeric. Average count to be added to each entry of the
matrix to avoid taking log of zero. Used only if |
stats |
input SNP correlation type. Used when |
h |
positive integer. Threshold distance for SNP correlation
computation. Used when |
axis |
logical. Should x-axis be displayed on the plot? Default to
|
naxis |
integer. If |
axistext |
character vector. If |
xlab |
character. If |
cluster_col |
colour for the cluster line if |
mode |
type of dendrogram to plot (see |
This function produces a heatmap for the used (dis)similarity matrix that can be used as a diagnostic plot to check the consistency between the obtained clustering and the original (dis)similarity
select
, adjClust
## Not run:
clustering <- rep(1:3, each = 50)
dist_data <- as.matrix(dist(iris[, 1:4]))
dendro_iris <- adjClust(dist_data, type = "dissimilarity")
plotSim(dist_data, type = "dissimilarity", dendro = dendro_iris, axis = TRUE)
plotSim(dist_data, type = "dissimilarity", dendro = dendro_iris,
clustering = clustering)
plotSim(dist_data, type = "dissimilarity", dendro = dendro_iris, axis = TRUE,
k = 3)
plotSim(dist_data, type = "dissimilarity", legendName = "IF", axis = TRUE,
clustering = clustering)
p <- plotSim(dist(iris[, 1:4]), type = "dissimilarity", log = FALSE,
clustering = clustering, cluster_col = "blue")
# custom palette
p + scale_fill_gradient(low = "yellow", high = "red")
# dsCMatrix
m <- Matrix(c(0, 0, 2, 0, 3, 0, 2, 0, 0), ncol = 3)
res <- adjClust(m)
plotSim(m, axis = TRUE)
plotSim(m, dendro = res)
# dgCMatrix
m <- as(m, "generalMatrix")
plotSim(m)
m <- as.dist(m)
if (require("HiTC", quietly = TRUE)) {
load(system.file("extdata", "hic_imr90_40_XX.rda", package = "adjclust"))
res <- hicClust(hic_imr90_40_XX, log = TRUE)
plotSim(hic_imr90_40_XX, axis = TRUE)
}
if (requireNamespace("snpStats", quietly = TRUE)) {
data(testdata, package = "snpStats")
plotSim(Autosomes[1:200, 1:5], h = 3, stats = "R.squared", axis = TRUE,
axistext = c("A", "B", "C", "D", "E"))
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.