Skip to contents

Render an image object using native base R graphics, with support for title, custom bounding limits (xlim, ylim), and axes.

Usage

# S3 method for class 'image'
plot(
  x,
  y = NULL,
  colormode = NULL,
  main = NULL,
  axes = FALSE,
  xlab = "",
  ylab = "",
  xlim = NULL,
  ylim = NULL,
  asp = 1,
  interpolate = TRUE,
  max_pixels = 2e+06,
  add = FALSE,
  ...
)

Arguments

x

An image object.

y

Unused.

colormode

Unused; reserved for compatibility.

main

Title for the plot.

axes

Logical; should axes be drawn? Default FALSE.

xlab

X-axis label.

ylab

Y-axis label.

xlim

X-axis limits.

ylim

Y-axis limits.

asp

Aspect ratio. Default 1.

interpolate

Logical; should raster image be interpolated? Default TRUE.

max_pixels

Maximum number of pixels to render on screen plot. Default 2e6 (2 MP) for fast rendering. Set to NULL for full resolution.

add

Logical; add to existing plot window? Default FALSE.

...

Additional graphical arguments passed to graphics::rasterImage().

Value

Invisibly returns the plotted image object.

Examples

if (FALSE) { # interactive()
img <- image(array(as.raw(sample(0:255, 30000)), dim = c(100, 100, 3)))
plot(img, main = "Sample Image")
plot(img, xlim = c(20, 80), ylim = c(20, 80), main = "Zoomed Region")
}