Description Usage Arguments Details Value See Also Examples
Make a Single Legend
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Legend(at, labels = at, col_fun, name = NULL,
break_dist = NULL, nrow = NULL, ncol = 1, by_row = FALSE,
grid_height = unit(4, "mm"),
grid_width = unit(4, "mm"),
gap = unit(2, "mm"), column_gap = gap, row_gap = unit(0, "mm"),
labels_gp = gpar(fontsize = 10), labels_rot = 0,
border = NULL, background = "#EEEEEE",
type = "grid", graphics = NULL, legend_gp = gpar(),
pch = 16, size = unit(2, "mm"),
legend_height = NULL, legend_width = NULL,
direction = c("vertical", "horizontal"),
title = "", title_gp = gpar(fontsize = 10, fontface = "bold"),
title_position = c("topleft", "topcenter", "leftcenter", "lefttop", "leftcenter-rot", "lefttop-rot"),
title_gap = unit(2, "mm"))
|
at |
Breaks of the legend. The values can be either numeric or character. If it is not specified, the values of |
labels |
Labels corresponding to |
col_fun |
A color mapping function which is used to make a continuous legend. Use |
name |
Name of the legend, internally used. |
break_dist |
A zooming factor to control relative distance of two neighbouring break values.The length of it should be |
nrow |
For legend which is represented as grids, |
ncol |
Similar as |
by_row |
Are the legend grids arranged by rows or by columns? |
grid_height |
The height of legend grid. It can also control the height of the continuous legend if it is horizontal. |
grid_width |
The width of legend grid. It can also control the width of the continuous legend if it is vertical. |
gap |
If legend grids are put into multiple rows or columns, this controls the gap between neighbouring rows or columns, measured as a |
column_gap |
The same as |
row_gap |
Space between legend rows. |
labels_gp |
Graphic parameters for labels. |
labels_rot |
Text rotation for labels. It should only be used for horizontal continuous legend. |
border |
Color of legend grid borders. It also works for the ticks in the continuous legend. |
background |
Background colors for the grids. It is used when points and lines are the legend graphics. |
type |
Type of legends. The value can be one of |
graphics |
Self-defined graphics for legends. The value should be a list of functions. Each function should accept four argumets: |
legend_gp |
Graphic parameters for the legend grids. You should control the filled color of the legend grids by |
pch |
Type of points if points are used as legend. Note you can use single-letter as pch, e.g. |
size |
Size of points. |
legend_height |
Height of the whole legend body. It is only used for vertical continous legend. |
legend_width |
Width of the whole legend body. It is only used for horizontal continous legend. |
direction |
Direction of the legend, vertical or horizontal? |
title |
Title of the legend. |
title_gp |
Graphic parameters of the title. |
title_position |
Position of title relative to the legend. |
title_gap |
Gap between title and the legend body. |
Most of the argument can also be set in heatmap_legend_param
argument in Heatmap
or annotation_legend_param
argument in HeatmapAnnotation
to configure legend styles for heatmap and annotations.
A Legends-class
object.
packLegend
packs multiple legends into one Legends-class
object.
See examples of configuring legends: https://jokergoo.github.io/ComplexHeatmap-reference/book/legends.html
1 2 3 4 5 6 7 8 9 10 11 | lgd = Legend(labels = month.name[1:6], title = "foo", legend_gp = gpar(fill = 1:6))
draw(lgd, test = "add labels and title")
require(circlize)
col_fun = colorRamp2(c(0, 0.5, 1), c("blue", "white", "red"))
lgd = Legend(col_fun = col_fun, title = "foo")
draw(lgd, test = "only col_fun")
col_fun = colorRamp2(c(0, 0.5, 1), c("blue", "white", "red"))
lgd = Legend(col_fun = col_fun, title = "foo", at = c(0, 0.1, 0.15, 0.5, 0.9, 0.95, 1))
draw(lgd, test = "unequal interval breaks")
|
Loading required package: grid
========================================
ComplexHeatmap version 2.6.2
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference
If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional
genomic data. Bioinformatics 2016.
This message can be suppressed by:
suppressPackageStartupMessages(library(ComplexHeatmap))
========================================
Loading required package: circlize
========================================
circlize version 0.4.11
CRAN page: https://cran.r-project.org/package=circlize
Github page: https://github.com/jokergoo/circlize
Documentation: https://jokergoo.github.io/circlize_book/book/
If you use it in published research, please cite:
Gu, Z. circlize implements and enhances circular visualization
in R. Bioinformatics 2014.
This message can be suppressed by:
suppressPackageStartupMessages(library(circlize))
========================================
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.