[ 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>]
[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?
]
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