Ggimage

setting ggplot2 background with ggbackground

ggimage 0.1.4 is available on CRAN. This release introduces a new function called ggbackground for setting image background as ggplot canvas. require(ggplot2) p <- ggplot(iris) + aes(x = Sepal.Length, y = Sepal.Width, color=Species) + geom_point(size=5) + theme_classic() Suppose we have the above ggplot object, p, the only thing we need to do is passing the p with an image file name (local or remote) to ggbackground, as demonstrated below: require(ggimage) img = "https://assets.

Annotating phylogenetic tree with images using ggtree and ggimage

With ggimage, we are able to plot images using grammar of graphics. The layers defined in ggimage can be directly applied to ggtree to annotate phylogenetic tree using local/online image files. ggtree seamlessly work with ggimage. The geom_tiplab and geom_nodelab can accept parameter of geom="image" to parse taxa labels as image files and use them to “label” the taxa using images instead of text strings. Here are some examples for demonstration.