我使用存储在单细胞实验分析中的单细胞RNA-seq数据,使用R中的pheatmap对~ 11.3000个表达基因(而不是聚类样本)进行层次聚类,以显示数据的异质性。我需要输出的图像是2x4英寸,这使得树状图变得模糊。是否有可能减少用于树状图的线宽?我试着用gpar设置线条宽度,但似乎没有变化
sessionInfo() R版本3.4.1 (2017-06-30)平台: i386-w64-mingw32/i386 (32位)运行环境: Windows >= 8 x64 (build 9200) pheatmap_1.0.8
R代码
gpar(lwd = 0.5)
pheatmap(assay(sce.tpm), cellwidth = 10, cellheight= 0.009, fontsize = 5,
fontsize_row = 6, fontsize_col = 6,
scale = "row", cluster_cols = F, cluster_rows = T,
clustering_distance_rows = "euclidean", clustering_method = "average"
color = colorRampPalette(c("blue", "white", "red"))(256),
show_colnames = T, show_rownames = F)
发布于 2018-07-21 03:19:05
您可以直接操作pheatmap调用返回的gtable对象。每个grob都有一个作为gpar
对象的gp
参数。
library(pheatmap)
library(grid)
set.seed(42)
ph <- pheatmap(matrix(runif(100), nrow = 10), silent = TRUE)
ph$gtable$grobs[[1]]$gp <- gpar(lwd = 5)
ph$gtable$grobs[[2]]$gp <- gpar(col = 'blue')
png('pheatmap_gpar.png', height = 400, width = 400)
grid.newpage()
grid.draw(ph$gtable)
dev.off()
它会生成以下集群热图:
https://stackoverflow.com/questions/50469883
复制相似问题