简体   繁体   English

如何在heatmap()中更改图例的标题?

[英]How to change the title of a legend in heatmap( )?

In ggplot2 to change a legend title you simply add + guides(fill=guide_legend(title="New Legend Title")). 在ggplot2中更改图例标题,您只需添加+指南(fill = guide_legend(title =“ New Legend Title”))。 But how do I do the same thing while using the Heatmap() function? 但是在使用Heatmap()函数时我该怎么做? Here is the heatmap I am attempting to label. 是我尝试标记的热图。 Please tell me if you need any other information! 如果您需要其他任何信息,请告诉我! (The title I would like to change is matrix_1 (我想更改的标题是matrix_1

Code: 码:

Heatmap(PATRIC_genomes_AMR_2.ris.mat2, row_names_side = "left",     
row_dend_side = "left", row_names_gp = gpar(cex=fontsize), 
column_names_gp = gpar(cex=fontsize), ) 

I think you have to edit the "name" argument. 我认为您必须编辑“名称”参数。 So for example: 因此,例如:

Heatmap(PATRIC_genomes_AMR_2.ris.mat2, row_names_side = "left",     
row_dend_side = "left", row_names_gp = gpar(cex=fontsize), 
column_names_gp = gpar(cex=fontsize), name="something else then matrix_1")

By the way, it would be nice to give information about the package you are using. 顺便说一句,最好提供有关您正在使用的软件包的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM