# May emit a "CPU time > 2.5 times elapsed time" NOTE in a CRAN check
if (requireNamespace("magick")) {
x_hex <- 0.5 + 0.5 * cos(seq(2 * pi / 4, by = 2 * pi / 6, length.out = 6))
y_hex <- 0.5 + 0.5 * sin(seq(2 * pi / 4, by = 2 * pi / 6, length.out = 6))
logo_filename <- system.file("img", "Rlogo.png" , package = "png")
grid.pattern_image(x_hex, y_hex, filename = logo_filename, type = "fit")
}
if (requireNamespace("magick")) {
# "tile" `type` image pattern depends on `magick` functionality
# which is not reliable across platforms
grid::grid.newpage()
try(grid.pattern_image(x_hex, y_hex, filename = logo_filename,
type = "tile"))
}
Run the code above in your browser using DataLab