Heatmap of Distance Clusters
2
0
Entering edit mode
4.0 years ago
genome_man ▴ 10

I want to create a heatmap of my different gene clusters pairwise distance relationship. The table I get is like the one below. So far, using ggplot2, I can only find methods like stat_density2d and geom_tile, which only work for displaying point density and representing evenly spaced points. I have also tried the heatmap() and heatmap.2() functions but have not been successful.

My DataFrame

data=data.frame(x=c(1,1,2,2,3,4,5,6,7,7,8,9),
y=c(2,4,5,1,3,8,4,8,1,1,6,9),
distance=c(66,84,93,76,104,29,70,19,60,50,46,36),
association = c("Positive", "Negative","Positive","Negative","Negative",
"Negative","Positive","Random","Random","Random","Positive","Positive"))

I want to create a color coded heatmap that has it's intensity based on the distance metric between x and y. Additionally I would like to annotate my labels based on my

enter image description here

or a heatmap like the one below: enter image description here

r R heatmap ggplot2 dataframe • 2.6k views
ADD COMMENT
1
Entering edit mode
4.0 years ago
ATpoint 82k

Use https://jokergoo.github.io/ComplexHeatmap-reference/book/. Offers extensive code examples, highly recommended tool.

ADD COMMENT
0
Entering edit mode
4.0 years ago
N15 ▴ 160

pheatmap allows euclidean distance clusters among rows/columns

https://davetang.org/muse/2018/05/15/making-a-heatmap-in-r-with-the-pheatmap-package/

ADD COMMENT

Login before adding your answer.

Traffic: 2263 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