Question: Heatmap - with diagonally split tiles
gravatar for YaGalbi
2.9 years ago by
Biocomputing, MRC Harwell Institute, Oxford, UK
YaGalbi1.5k wrote:

Hi all,

I'd like to create a heatmap in which the individual cells are split diagonally so that:

1 - each cell can contain 2 colours

2 - different colours can be assigned based on category

3 - different shades can be applied based on a numerical scale

I'm not even sure what terms are used to search for this type of heatmap so am struggling to find a tool that can do it.

This image is a nice example from this paper but the methods don't state the tool used to create it.

EDIT: I contacted the authors who shared the bespoke script for the heatmap - it is 700 lines of AWK code :( - I think I'll be giving that a skip in favour of EagleEye's suggestion below :)

UPDATE: For completion, corrplot works great when X and Y axis labels are identical (i.e. when plotting a correlation). But this does not work otherwise. Jean Karims suggestion of instead finding another way of plotting 3D data would be better e.g. plot3D

heatmap split • 2.3k views
ADD COMMENTlink modified 2.8 years ago • written 2.9 years ago by YaGalbi1.5k

I'd probably do it from scratch as this gives more control. Basically you want to layout some two-color squares in a grid. You could do this with your favorite scripting language.
To reuse existing code, I can think of a few options in R:
- adapt the scatterpie package
- use the igraph package with custom node graphics
- adapt the pieGlyph() function from the Rgraphviz package
- adapt the pies() function from the caroline package

However, I don't find this kind of plot particularly informative. What you're trying to do is represent a 3D data set in 2D. Depending on what message you want to convey, there may be better ways of visualizing it.
If you want to keep the heatmap style, you could convert the two values per cell into one. For example, the 2 values could be seen as the x,y coordinates of the end of a vector so if you are interested in how the two change together, you could replace the two values by the cosine of the angle of the vector (maybe projecting on the unit circle).

ADD REPLYlink modified 2.9 years ago • written 2.9 years ago by Jean-Karim Heriche21k

Thank you both Jean Karim and EagleEye... I will have a look at both of those suggestions.

I am trying to represent 3D data in 2D, that is correct. I want to split each tile on the heatmap diagonally. The upper diagonal is to be represent the number of significant differentially expressed genes identified by diffbind with increased expression, while the lower diagonal will show those with decreased expression. Should be simple enough but will make good practice as a starting point for showing something more complicated in future.

Thanks again :)

ADD REPLYlink modified 2.9 years ago • written 2.9 years ago by YaGalbi1.5k
gravatar for EagleEye
2.9 years ago by
EagleEye6.6k wrote:

Did you have a look at corrplot ?

Try method "pie" and make 50-50% division and have two colors in single cell with two different categories.

ADD COMMENTlink modified 2.9 years ago • written 2.9 years ago by EagleEye6.6k

I think that's the simplest option EagleEye - I actually found an example of that here - thank you

ADD REPLYlink modified 2.8 years ago by genomax80k • written 2.8 years ago by YaGalbi1.5k

Note: Edited to correct html link.

ADD REPLYlink written 2.8 years ago by genomax80k

Hi EagleEye,

I've done what I can with corrplot, however I don't see any options for editing what "pie" displays, or any way of having 2 colors in a single cell. The best I've managed is a plot where the cells of the upper right triangle contain the values for one variable (upregulation count) while the lower left triangle contains the values for the other (downregulation count).

Any suggestions?

ADD REPLYlink modified 2.8 years ago • written 2.8 years ago by YaGalbi1.5k

Excuse me? Have you found the way to produce this figure? Now I'm doing the similar thing but I could not find an appropriate package or way to plot it.

ADD REPLYlink written 18 months ago by guohong18740
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 948 users visited in the last hour