首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >pheatmap:更改文本颜色

pheatmap:更改文本颜色
EN

Stack Overflow用户
提问于 2019-01-11 11:50:10
回答 1查看 1.4K关注 0票数 1

如何更改pheatmap中的文本颜色?我尝试了以下方法,但它不会更改轴、文本和标签,但它不起作用

代码语言:javascript
复制
par( col.lab="#FFFFFF", fg="#FFFFFF", col.main="#FFFFFF", col.axis="#FFFFFF", cex.main=2, cex=2)
pheatmap(heat_data, cluster_rows = FALSE, gaps_row = c(3), cellwidth=35, cellheight=35, fontsize = 25)
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-01-12 05:24:16

这就是答案。代码修改x和y标签的颜色和字体大小,以及树状图的颜色和线宽。颜色设置为白色,但您可以将其更改为其他颜色。

代码语言:javascript
复制
p = pheatmap(heat_data, cluster_rows=F,  gaps_row = 3, 
            cellwidth=45, cellheight=45, fontsize = 20, angle_col = "90", legend=TRUE,legend_breaks=c(40, 20, 0, -20, -40, -60),
             legend_labels=c(40, 20, " 0", -20, -40, -60), annotation_row = NULL,
            annotation_legend = FALSE, labels_row = NULL, labels_col=NULL, 
            annotation_names_row = F, annotation_names_col = F, annotation_colors  = ann_colors, dist="euclidean", 
            col=COLS, scale="none", show_rownames = T, show_colnames = T)
my_gtable = p$gtable

my_gtable$grobs[[3]]$gp=gpar(col="#ffffff", fontsize=20)# assuming that the xlabels are in the third grob
my_gtable$grobs[[4]]$gp=gpar(col="#ffffff", fontsize=20)# assuming that the ylabels are in the fourth grob
my_gtable$grobs[[1]]$gp=gpar(col="#ffffff", lwd=2) # change the color of the dendrogram and set the linewidth to 2
my_gtable$grobs[[5]]$gp=gpar(col="#ffffff", fontsize="20", just="center") # legend
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54140152

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档