setting ggplot2 background with ggbackground

img = ""
ggbackground(p, img)

This image file is too colorful and it is hard to see the patterns of the data points. We can manipulate the image using the functions provided by magick package. For example, the following function emulate a classic high-pass filter from photoshop:

ggbackground(p, img, 
    image_fun = function(x) image_negate(image_convolve(x, 'DoG:0,0,2')))

Here are examples of setting transparency and color:

img = ""
p1 = ggbackground(p, img) + ggtitle("ggbackground(p, img)")
p2 = ggbackground(p, img, alpha=.3) + ggtitle("ggbackground(p, img, alpha=.3)")
p3 = ggbackground(p, img, alpha=.3, color="steelblue") + ggtitle('ggbackground(p, img, alpha=.3, color="steelblue")')
cowplot::plot_grid(p1, p2, p3, ncol=3)

Guangchuang Yu
Professor of Bioinformatics

I am a Professor of Bioinformatics at Southern Medical University. I am broadly interested in bioinformatics, metagenomics and molecular evolution.
I love the R programming language and have contributed 10 Bioconductor packages to the community.