0

[ Reference: <Evolutionary origins of the SARS-CoV-2 sarbecovirus lineage responsible for the COVID-19 pandemic(extended fig.5),Using the code from https://github.com/TD-lab-Wu/SARSCoV2origins>] 1

[3 differences : Question1:how to make the legend on the bottom of the picture by using the packege pheatmap? Question2:how to make the slight margin between the cells? Q3.How to draw the 4 horizontal lines for the 4 clusters? ]2

Here is the code from the paper:

install.packages("tidyverse")
library(pheatmap)
library(viridis)
library(ggrepel)
library(ggpmisc)
library(rlang)
# RSCU Heatmap ------------------------------------------------------------

all_rscu = read.csv("https://raw.githubusercontent.com/plemey/SARSCoV2origins/master/codonUsage/all_rscu_codonBiasReanalysis.csv")

all_df <- as.data.frame(all_rscu[,2:26])
row.names(all_df) <- all_rscu$codon

pheatmap(all_df,
         cluster_rows = F,
         gaps_row = c(10, 14),
         scale = 'none',
         fontsize_row = 5,
         fontsize_col = 10,
         color = magma(50),
         border_color = NA,
         cutree_cols = 4
      
)

I check the pheatmap in the CRAN,so many functions,but i did not find one way to fix these problems,and this is the same question when i look for answer in the stackoverflow,https://stackoverflow.com/questions/63951276/how-to-put-key-values-and-legends-at-the-bottom-of-the-heatmap

Best Regards

Park
  • 14,771
  • 6
  • 10
  • 29
  • I think this tutorial can solve your problems https://towardsdatascience.com/pheatmap-draws-pretty-heatmaps-483dab9a3cc – Bloxx Oct 25 '21 at 08:27
  • For Q2: Change argument to `border_color = "grey"` – Bloxx Oct 25 '21 at 08:35
  • Sorry for spam, I checked one of my old heatmaps. To solve most of the problems, I used package `ComplexHeatmap`. Look at the link (https://jokergoo.github.io/ComplexHeatmap-reference/book/integrate-with-other-packages.html), specifically Chapter 10.1 – Bloxx Oct 25 '21 at 08:44
  • thx,very useful information. – user17234955 Oct 25 '21 at 10:29

0 Answers0