anno_image.Rd
Image Annotation
anno_image(image, which = c("column", "row"), border = TRUE, gp = gpar(fill = NA, col = NA), space = unit(1, "mm"), width = NULL, height = NULL)
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 |
space | The space around the image to the annotation grid borders. The value should be a |
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. |
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.
An annotation function which can be used in HeatmapAnnotation
.
# download the free icons from https://github.com/Keyamoon/IcoMoon-Free # \dontrun{ image = sample(dir("~/Downloads/IcoMoon-Free-master/PNG/64px", full.names = TRUE), 10)#> Error in sample.int(length(x), size, replace, prob): invalid first argumentanno = anno_image(image)#> Warning: is.na() applied to non-(list or vector) of type 'closure'#> Error in image[is.na(image)] <- "": object of type 'closure' is not subsettable#> Error in draw(anno, test = "png"): object 'anno' not foundimage[1:5] = ""#> Error in image[1:5] = "": object of type 'closure' is not subsettableanno = anno_image(image)#> Warning: is.na() applied to non-(list or vector) of type 'closure'#> Error in image[is.na(image)] <- "": object of type 'closure' is not subsettable#> Error in draw(anno, test = "some of png"): object 'anno' not found# }