I just add geom_subtile()
and geom_subrect()
function in package ggalign to subdivide rectangles with shared borders into a grid.
library(reshape2)
library(ggplot2)
m <- matrix(
c("SNV", "SNV", NA, NA, "INDEL", "SNV", "INDEL", "SNV", "SNV/INDEL"),
3, 3
)
ggplot(
tidyr::separate_longer_delim(melt(m), value, delim = "/"),
aes(Var1, Var2, fill = value)
) +
geom_subtile(color = "yellow", linewidth = 2) +
xlab("Patient") +
ylab("Gene")
If you want to draw the oncoplot, ggalign
provide more advanced function to do this, it can do everything ComplexHeatmap
can, and even more!
The oncoplot vignette is here: https://yunuuuu.github.io/ggalign/dev/articles/oncoplot.html