plotImage | R Documentation |
This function takes in an image-related object - path to JP(E)G/PNG file, raster object, RGBarray. It returns a ggplot object with the selected image.
x |
A variety of objects can be passed: character string corresponding to an image file path, valid file types are JPG, JPEG and PNG. It can also take as input objects of class raster and RGB arrays. It can also take a SpatialExperiment from which the image will be extracted. |
slice |
Character string indicating which image slice to use when SpatialExperiment objects are passed. By default uses the first slice available. |
ggplot
object
Marc Elosua Bayes & Helena L Crowell
# Filename
path <- file.path(
system.file(package = "SPOTlight"),
"extdata/SPOTlight.png")
plotImage(x = path)
# array
png_img <- png::readPNG(path)
plotImage(png_img)
# SpatialExperiment
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.