Image Annotation
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 ## 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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.