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
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).
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 :)