Add annotations to ggplot heatmap
add_annotation(
plt,
context = c("rows", "cols"),
annot_df,
annot_pos,
annot_size,
annot_border_lwd = 0.5,
annot_border_col = "grey",
annot_border_lty = 1,
show_annot_names = TRUE,
na_remove = FALSE,
col_scale = NULL,
names_side,
name_params = NULL
)
ggplot
object with added annotations.
ggplot
object with geom_tile
layer to add annotations to.
Dimension to add annotations to, either "rows" or "columns".
Data frame containing the annotations. The first column must contain the labels used in the heatmap rows or columns. Each of the other columns should contain corresponding annotations. The column names are used as labels in the legend.
Positions of annotations. x positions if row annotations, y positions if column annotations. Positions are given by the middle coordinate of the annotation cells.
Size of annotations, width of row annotations, height if column annotations.
Linewidth of border lines of annotation cells.
Colour of border lines of annotation cells.
Linetype of border lines of annotation cells.
Logical indicating if the annotation names should be drawn.
Logical indicating if NA values should be removed.
Named list of fill scales to use, named after the columns in the annotation data frame.
Each element should either be a scale_fill_*
object or a string specifying a brewer palette or viridis option.
String specifying which side the labels should be drawn on. "top" or "bottom" for row annotation, "left" or "right" for column annotation.
A named list of parameters to give grid::textGrob
to modify annotation label appearance.