ComplexHeatmap icon indicating copy to clipboard operation
ComplexHeatmap copied to clipboard

Possible to add brackets and significant stars besides the oncoprint heatmap?

Open LitingKu opened this issue 2 years ago • 1 comments

Hi, I have tried to create the oncoprint and I’m wondering is it possible to add significant stars besides the oncoprint, like this?

7130C11E-7689-44B1-89FD-7464EE312A44

Or this 0FBDCD25-BD66-4635-930C-AA8F978AFC8F

I have tried to combined with ggplot but I feel like I’m unable to do so?

I’m wondering is there a way to do this?

Thank you so much!!

LitingKu avatar Aug 04 '22 20:08 LitingKu

You can first add an empty annotation and later add graphics in it:

m = matrix(rnorm(40), nrow = 4)

Heatmap(m) + rowAnnotation(foo = anno_empty(border = FALSE, width = unit(2, "cm")))

decorate_annotation("foo", {
	grid.lines(unit(c(1, 2, 2, 1), "mm"),
		   unit(c(5/8, 5/8, 7/8, 7/8), "npc"))
	grid.text("***", unit(3, "mm"), unit(6/8, "npc"), rot = 90, just = "top")

	grid.lines(unit(c(5, 6, 6, 5), "mm"),
		   unit(c(3/8, 3/8, 7/8, 7/8), "npc"))
	grid.text("**", unit(7, "mm"), unit(5/8, "npc"), rot = 90, just = "top")

	grid.lines(unit(c(9, 10, 10, 9), "mm"),
		   unit(c(1/8, 1/8, 7/8, 7/8), "npc"))
	grid.text("*", unit(11, "mm"), unit(4/8, "npc"), rot = 90, just = "top")
})

image

jokergoo avatar Sep 01 '22 07:09 jokergoo