anno_image {ComplexHeatmap} | R Documentation

## Image Annotation

### Description

Image Annotation

### Usage

    anno_image(image, which = c("column", "row"), border = TRUE,
        gp = gpar(fill = NA, col = NA), space = unit(1, "mm"),
        width = NULL, height = NULL)

### Arguments

`image` | A vector of file paths of images. The format of the image is inferred from the suffix name of the image file. NA values or empty strings in the vector means no image to drawn.
`which` | Whether it is a column annotation or a row annotation?
`border` | Wether draw borders of the annotation region?
`gp` | Graphic parameters for annotation grids. If the image has transparent background, the `fill` parameter can be used to control the background color in the annotation grids.
`space` | The space around the image to the annotation grid borders. The value should be a `unit` object.
`width` | Width of the annotation. The value should be an absolute unit. Width is not allowed to be set for column annotation.
`height` | Height of the annotation. The value should be an absolute unit. Height is not allowed to be set for row annotation.

### Details

This function supports image formats in `png`, `svg`, `pdf`, `eps`, `jpeg/jpg`, `tiff`. `png`, `jpeg/jpg` and `tiff` images are imported by `readPNG`, `readJPEG` and `readTIFF`, and drawn by `grid.raster`. `svg` images are firstly reformatted by `rsvg::rsvg_svg` and then imported by `readPicture` and drawn by `grid.picture`. `pdf` and `eps` images are imported by `PostScriptTrace` and `readPicture`, later drawn by `grid.picture`.

Different image formats can be mixed in the `image` vector.

### Value

An annotation function which can be used in `HeatmapAnnotation`.

### See Also

https://jokergoo.github.io/ComplexHeatmap-reference/book/heatmap-annotations.html#image-annotation

### Examples

    # download the free icons from https://github.com/Keyamoon/IcoMoon-Free
    ## Not run:
    image = sample(dir("~/Downloads/IcoMoon-Free-master/PNG/64px", full.names = TRUE), 10)
    anno = anno_image(image)
    draw(anno, test = "png")
    image[1:5] = ""
    anno = anno_image(image)
    draw(anno, test = "some of png")

    ## End(Not run)

[Package ComplexHeatmap version 2.3.4 Index]