Displays the image in the current device.

plot_image(
  input,
  rotate = 0,
  draw_grid = FALSE,
  asp = 1,
  new_page = TRUE,
  return_grob = FALSE
)

Arguments

input

Image or filename of an image to be plotted.

rotate

Default 0. Rotates the output. Possible values: 0, 90, 180, 270.

draw_grid

Default FALSE. If TRUE, this will draw a grid in the background to help disambiguate the actual image from the device (helpful if the image background is the same as the device's background).

asp

Default 1. Aspect ratio of the pixels in the plot. For example, an aspect ratio of 4/3 will slightly widen the image.

new_page

Default TRUE. Whether to call grid::grid.newpage() before plotting the image.

return_grob

Default FALSE. Whether to return the grob object.

Examples

#if(interactive()){
#Plot the dragon array
plot_image(dragon)

#Make pixels twice as wide as tall
plot_image(dragon, asp = 2)

#Plot non-square images
plot_image(dragon[1:100,,])

#Make pixels twice as tall as wide
plot_image(dragon[1:100,,], asp = 1/2)

#end}