This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Renaming ggplot heatmap x-axis from gene names to number of genes

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

0 answers

No answers yet.

Log in to answer this question.