rlbarter / superheat

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

Keeping vector order in `membership.rows` option #38

Closed seantma closed 5 years ago

seantma commented 6 years ago

@rlbarter Thanks again for this awesome package!

I want to ask if it's possible to preserve the original order in the vector I provide to membership.rows option in superheat. Currently, the program seems to sort the vector order automatically.

Below is some sample code to reproduce this question. I'm manually assigning a group vector to my random matrix.

set.seed(100)
mat <- matrix(runif(100, min = -1, max = 1),ncol=10)
group <- sample(letters, 10)

superheat(mat)

superheat(mat,
          membership.rows = group)

The results are below. Rather than keeping the original matrix order, the new heatmap is self sorted by the group value which I did not intend to.

Is there a way to preserve the vector order I've provided to membership.rows or membership.col?

screen shot 2018-07-20 at 3 06 54 pm screen shot 2018-07-20 at 3 09 21 pm
rlbarter commented 5 years ago

Hi Sean!

Thanks for brining this to my attention. So sorry for my ultra-delayed response (I've been focusing on other projects). I've implemented a bug fix so that superheat now preserves the group order provided in membership.rows or membership.cols. Feel free to re-open if this didn't solve your problem (if indeed you still care about this problem!)