Open zor4x opened 1 year ago
YOU JUST NEED TO USE the SAME COLOR MAPPING FUNCTION FOR BOTH PLOTS :)
pooled = c(mat2, mat)
col_fun = circlize::colorRamp2(c(min(pooled), max(pooled)), c("white", "red"))
EnrichedHeatmap(mat2, name = "fragment ko", col = col_fun, column_title = "Enrichment KO") +
EnrichedHeatmap(mat, name = "fragment WT", col = col_fun, column_title = "Enrichment of WT")
I'm sorry if I didn't explain myself well, I meant the scale of the annotation. maybe the picture is clearer now:
I would have the same value to compare them properly :D
OK, then, in the function anno_enriched()
, you can set the same value for ylim
:
EnrichedHeatmap(mat2, name = "fragment ko", col = col_fun, column_title = "Enrichment KO",
top_annotation = HeatmapAnnotation(enriched1 = anno_enriched(ylim = c(0, 0.3))) +
EnrichedHeatmap(mat, name = "fragment WT", col = col_fun, columçn_title = "Enrichment of WT",
top_annotation = HeatmapAnnotation(enriched1 = anno_enriched(ylim = c(0, 0.3)))
Thank you very much @jokergoo :D
I have another question hoping that I'm not bothering you too much. I would to take the annotations of both heatmaps and color the area of overlap with a grey color. I will post you an example:
Thank you again @jokergoo
No , it is not possible. Do you want to emphasize the difference between the two lines?
Or you can do it without EnrichedHeatmap. The two lines can be obtained by
x1 = colMeans(m[group == "KO d8", ])
x2 = colMeans(m[group == "WT d8", ])
y = seq(-1000, 1000, length(x1))
And the area can be drawn by :
polygon(c(x1, rev(x2)), c(y, rev(y))
# or
grid.polygon(c(x1, rev(x2)), c(y, rev(y)), default.units = "native")
Hi, I was trying to plot a matrix using EnrichedHeatmap. I imported my original matrix:
and I plotted them using EnrichedHeatmap using this code:
EnrichedHeatmap(mat2, name = "fragment ko", col = c("white", "red"), column_title = "Enrichment KO") + EnrichedHeatmap(mat, name = "fragment WT", col = c("white", "red"), column_title = "Enrichment of WT")
My question is: I WOULD LIKE TO COMPARE THE TWO PLOTS USING THE SAME SCALE. HOW CAN I SET THE SCALE PARAMETERS TO BE THE SAME IN BOTH PLOTS? THANK YOU