heatmaply
heatmaply copied to clipboard
Clustering using k_col
Hi, I really love using heatmaply and I am really happy with the k_col argument. To obtain a list of these clusters I used the hclust and dist functions. But is it possible to obtain some sort of legend to number these clusters as in my dend and cut object ? (I'll note that my data table is transposed before plotting)
library("heatmaply")
data <- mtcars
dend <- hclust(dist(t(data), method = 'euclidean'), method = 'ward.D2')
cut <- cutree(dend, k = 5)
# As my heatmap is :
heatmaply(
data,
colors = RdYlGn(100),
k_col = 5,
dist_method = 'euclidean',
hclust_method = 'ward.D2',
xlab = "Gene",
ylab = "Sample",
margins = c(150, 100, 40, 20),
scale = "none",
labCol = colnames(data),
labRow = rownames(data)
)
Thank you very much! Margaux
Do you mean a legend on the heatmap?
An annotation bar to specify which cluster is the nb1, nb2, nb3..., nb15
Ah, yeah legends are a bit tricky with plotly. I'll see if things are easier than before.
Thank you very much for your time!