Teichlab / cellphonedb

MIT License
339 stars 105 forks source link

Heatmap plot ordering - sample comparison #246

Open ms3389 opened 3 years ago

ms3389 commented 3 years ago

Hi,

I was interested in comparing 2 different samples regarding their amount of interactions. However even though I have the exact same cluster names in both - the heatmap ordering is always different. I tried sorting the meta data file but it appears that the order is being pulled from somewhere else. Is there a way to set the order on the heatmap?

Thanks.

prete commented 3 years ago

Source code for plotting heatmap is here: https://github.com/Teichlab/cellphonedb/blob/master/cellphonedb/src/plotters/R/plot_heatmaps.R

To achieve what you're after you can manually run that R script (passing all the parameters needed). Edit the code the use something like the order function to sort the matrix before plotting.