how to plot one-dimeson heatmap using R
1
0
Entering edit mode
2.9 years ago
szp770 ▴ 10

I am intersted in one perticular gene, and I want to see the correlation of this gene and other hundreds of genes, so I generate a one-dimension matrix like this:

geneA--interested_gene    0.86
geneB--interested_gene    0.23
........
geneZ--interested_gene    -0.15

How to plot heatmap using this data?

R heatmap • 1.0k views
ADD COMMENT
0
Entering edit mode

Please post the data and the code you tried.

ADD REPLY
0
Entering edit mode

the example data is just like what I showed above, the first column is the genes name, and the second column is the correlation value of the gene in first column with the interested gene, I loaded this data in R and plot heatmap using pheatmap directly.

ADD REPLY
0
Entering edit mode
2.9 years ago
zx8754 11k

Try this example:

# example data
set.seed(1); d <- data.frame(
  g1 = paste0("gene", 1:5),
  g2 = "myGene",
  cor = runif(5))

library(ggplot2)

ggplot(d, aes(g1, g2, fill = cor)) +
  geom_tile() + 
  theme_minimal()
ADD COMMENT

Login before adding your answer.

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