rlbarter / superheat

An r package for generating beautiful and customizable heatmaps
https://rlbarter.github.io/superheat/
235 stars 29 forks source link

RowSideColors alternative? #48

Closed bblodfon closed 5 years ago

bblodfon commented 5 years ago

Hi Rebecca,

First of all, this is such a great R library! Great work indeed!

Maybe you can help me with the following, I don't know how to do it with superheat, but I think it can be done:

superheat(X, 
            row.dendrogram = FALSE, col.dendrogram = TRUE, scale = FALSE,
            left.label.col = row.side.colors, left.label.text.size = 0,
            clustering.method = "hierarchical", dist.method = "euclidean",
            grid.hline = FALSE, grid.vline = FALSE,
            bottom.label.text.size = 4, bottom.label.text.angle = 90, 
            bottom.label.col = "white")

So, X (7500x140 size) is already sorted row-wise and I have already calculated the row colors I want. So, I do only the column dendrogram and I want to put a color bar in the left side of the heatmap - so in superheat reduce the label name sizes to zero and have the label colors presented only. In heatmap I was doing:

heatmap(X, RowSideColors = row.side.colors, scale = "none", labRow = NA, Rowv = NA)

I tested the same technique with smaller row sizes for X and it works, but it breaks after the row size is larger than 100 I believe (probably you disable the row labeling feature because they wouldn't be readable I guess). What do you suggest as an alternative?

BR, John.

rlbarter commented 5 years ago

Hi John,

In future it would be great if you could provide a reproducible example (E.g. give me code that produces an X object that I can use to run your code).

If I'm understanding your problem correctly, it seems that you should be able to use the force.left.label = TRUE argument (https://rlbarter.github.io/superheat/labels.html) to solve your problem.

Feel free to re-open if I didn't answer your question!

bblodfon commented 5 years ago

I ended up doing a right barplot to solve this, but your solution is neat! (I had missed it in the documentation, thanks for pointing it out!)