Renaming ggplot heatmap x-axis from gene names to number of genes
0
0
Entering edit mode
3.3 years ago
Anand ▴ 40

I've been able to create a gene expression heatmap of LogFC using the following code:

ggplot(dat, aes(gene_id, type, fill = logFC)) + 
  geom_tile()  + 
  theme_void() +
  theme(axis.text.x = element_blank(),
        axis.title = element_blank(),
        legend.position = "top") +
  scale_fill_gradientn(colours = c("dodgerblue4", "dodgerblue3","dodgerblue2", "dodgerblue1","white",
                                   "firebrick1", "firebrick2","firebrick3", "firebrick4"),
                       values = rescale(c(-5, 0, 5))) +
  guides(fill = guide_colourbar(barwidth = 30, barheight = 2, title.vjust = 1)) +
  theme(axis.text = element_text(size = 24),
        legend.text = element_text(size = 20),
        legend.title = element_text(size = 20))

Instead of the 1000+ gene names as x-axis ticks, i'd like to replace them just with the number of DEGs in total with breaks. Similar to the second image I have posted up. Any help or advice would be much appreciated.

logFC heatmap

heatmap of number of DGEs

axes ggplot2 heatmap • 737 views
ADD COMMENT

Login before adding your answer.

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