作者:Zuguang Gu8
编译:Steven Shen
原文:Legends
第五章 图例
The heatmaps and simple annotations automatically generate legends which are put one the right side of the heatmap. By default there is no legend for complex annotations, but they can be constructed and added manually (Section 5.5). All legends are internally constructed by
Legend()constructor. In later sections, we first introduce the settings for continuous legends and discrete legends, then we will discuss how to configure the legends associated with the heatmaps and annotations, and how to add new legends to the plot.All the legends (no matter a single legend or a pack of legends) all belong to the
Legendsclass. The class only has one slotgrobwhich is the realgrid::grobobject or thegrid::gTreeobject that records how to draw the graphics. The wrapping of theLegendsclass and the methods designed for the class make legends as single objects and can be drawn like points with specifying the positions on the viewport.The legends for heatmaps and annotations can be controlled by
heatmap_legend_paramargument inHeatmap(), orannotation_legend_paramargument inHeatmapAnnotation(). Most of the parameters inLegend()function can be directly set in the two arguments with the same parameter name. The details of setting heatmap legends and annotation legends parameters are introduced in Section 5.4.
