R pheatmap 图例显示不完整/超出边界 添加标题 解决办法

转换为ggplot对象,调整右边距

p <- pheatmap(...)
loadp(ggplotify)
as.ggplot(p) + theme(plot.margin = margin(l = 5, r = 10)) + 
        labs(title = "lncRNA heatmap") + 
        theme(plot.title  = element_text(color = "black", size = 20, face = "bold", hjust = 0.4))

前:


后:


你可能感兴趣的:(R pheatmap 图例显示不完整/超出边界 添加标题 解决办法)