Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clustering using k_col #235

Open
margauxhaering opened this issue Mar 24, 2020 · 4 comments
Open

Clustering using k_col #235

margauxhaering opened this issue Mar 24, 2020 · 4 comments

Comments

@margauxhaering
Copy link

margauxhaering commented Mar 24, 2020

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

@alanocallaghan
Copy link
Collaborator

Do you mean a legend on the heatmap?

@margauxhaering
Copy link
Author

An annotation bar to specify which cluster is the nb1, nb2, nb3..., nb15

@alanocallaghan
Copy link
Collaborator

Ah, yeah legends are a bit tricky with plotly. I'll see if things are easier than before.

@margauxhaering
Copy link
Author

Thank you very much for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants