Add image to a track

spiral_raster(
  x,
  y,
  image,
  width = NULL,
  height = NULL,
  facing = c("downward", "inside", "outside", "curved_inside", "curved_outside"),
  nice_facing = FALSE,
  scaling = 1,
  track_index = current_track_index()
)

Arguments

x

X-locations of the center of the image.

y

Y-locations of the center of the image.

image

A vector of file paths of images. The format of the image is inferred from the suffix name of the image file. NA value or empty string means no image to drawn. Supported formats are png/svg/pdf/eps/jpeg/jpg/tiff.

width

Width of the image. See Details.

height

Height of the image. See Details.

facing

Facing of the image.

nice_facing

Whether to adjust the facing.

scaling

Scaling factor when facing is set to "curved_inside" or "curved_outside".

track_index

Index of the track.

Value

No value is returned.

Details

When facing is set to one of "downward", "inside" and "outside", both of width and height should be grid::unit() objects. It is suggested to only set one of width and height, the other dimension will be automatically calculated from the aspect ratio of the image.

When facing is set to one of "curved_inside" and "curved_outside", the value can also be numeric, which are the values measured in the data coordinates. Note when the segment in the spiral that corresponds to width is very long, drawing the curved image will be very slow because each pixel is actually treated as a single rectangle.

Examples

image = system.file("extdata", "Rlogo.png", package = "circlize")
x = seq(0.1, 0.9, length = 10)

spiral_initialize()
spiral_track()
spiral_raster(x, 0.5, image)


spiral_initialize()
spiral_track()
spiral_raster(x, 0.5, image, facing = "inside")