This function is very similar to the rasterImage function. It works with every loon plot which is based on the cartesian coordinate system.

l_layer_rasterImage(
  widget,
  image,
  xleft,
  ybottom,
  xright,
  ytop,
  angle = 0,
  interpolate = FALSE,
  parent = "root",
  index = "end",
  ...
)

Arguments

widget

widget path as a string or as an object handle

image

a raster object, or an object that can be coerced to one by as.raster.

xleft

a vector (or scalar) of left x positions.

ybottom

a vector (or scalar) of bottom y positions.

xright

a vector (or scalar) of right x positions.

ytop

a vector (or scalar) of top y positions.

angle

angle of rotation (in degrees, anti-clockwise from positive x-axis, about the bottom-left corner).

interpolate

a logical vector (or scalar) indicating whether to apply linear interpolation to the image when drawing.

parent

a valid Tk parent widget path. When the parent widget is specified (i.e. not NULL) then the plot widget needs to be placed using some geometry manager like tkpack or tkplace in order to be displayed. See the examples below.

index

position among its siblings. valid values are 0, 1, 2, ..., 'end'

...

argumnets forwarded to l_layer_line

Value

layer id of group or rectangles layer

Details

For more information run: l_help("learn_R_layer.html#countourlines-heatimage-rasterimage")

Examples

if(interactive()){ plot(1,1, xlim = c(0,1), ylim=c(0,1)) mat <- matrix(c(0,0,0,0, 1,1), ncol=2) rasterImage(mat, 0,0,1,1, interpolate = FALSE) p <- l_plot() l_layer_rasterImage(p, mat, 0,0,1,1) l_scaleto_world(p) image <- as.raster(matrix(0:1, ncol = 5, nrow = 3)) p <- l_plot(showScales=TRUE, background="thistle", useLoonInspector=FALSE) l_layer_rasterImage(p, image, 100, 300, 150, 350, interpolate = FALSE) l_layer_rasterImage(p, image, 100, 400, 150, 450) l_layer_rasterImage(p, image, 200, 300, 200 + 10, 300 + 10, interpolate = FALSE) l_scaleto_world(p) # from examples(rasterImage) # set up the plot region: op <- par(bg = "thistle") plot(c(100, 250), c(300, 450), type = "n", xlab = "", ylab = "") rasterImage(image, 100, 300, 150, 350, interpolate = FALSE) rasterImage(image, 100, 400, 150, 450) rasterImage(image, 200, 300, 200 + 10, 300 + 10, interpolate = FALSE) }