R/egg.image.R

Defines functions egg.image

Documented in egg.image

#' Plot raster image
#'
#' Plots a raster image of an egg
#'
#' @param img an array representing the image to be plotted
#' @param axes logical, whether or not to plot axes
#'
#' @return None
#'
#' @examples
#' stop()
#'
#' @export
egg.image = function(img, axes=FALSE) {
  if(exists("rasterImage")) {
    dim = attributes(img)$dim
    plot(c(1,dim[2]), c(1,dim[1]), type="n", xlab="", ylab="", asp=1, axes=axes)
    rasterImage(img, 1, 1, dim[2], dim[1], interpolate=FALSE)
  } else {
    stop("Sorry, you cannot plot raster images.")
  }
}

Try the egg package in your browser

Any scripts or data that you put into this service are public.

egg documentation built on May 2, 2019, 5:55 p.m.