how to plot one-dimeson heatmap using R
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?
• 1,753 views
•
link
1 answer
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()
• 0 views
•
link
Log in to answer this question.
Please post the data and the code you tried.
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.
Plotting SNP density heatmap chromosome ideogram