Heatmap - with diagonally split tiles
1
4
Entering edit mode
7.5 years ago
BioinfGuru ★ 2.1k

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 • 6.1k views
ADD COMMENT
1
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
2
Entering edit mode
7.5 years ago
EagleEye 7.6k

Did you have a look at corrplot ? https://cran.r-project.org/web/packages/corrplot/vignettes/corrplot-intro.html

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

ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

Note: Edited to correct html link.

ADD REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY

Login before adding your answer.

Traffic: 1329 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6