Read image and convert to ggplot object, for use with other ggplot objects
when assembling with the {patchwork}
package. Can also specify a
border.
fig(
path,
aspect.ratio = "default",
link_dim = TRUE,
b_col = NULL,
b_size = 1,
b_pos = "offset",
b_margin = ggplot2::margin(4, 4, 4, 4)
)
Path to image file.
Manually override the image's aspect ratio or set "free" to allow fig to be resized by patchwork.
Logical, whether to lock the dimensions & aspect.ratio of the aligned plots to that of this fig.
Colour of the border line.
Size of the border line.
Whether the border is 'offset' (expands out from figure) or 'inset' and expands inwards, partially covering up the figure.
Margin around the fig. Use ggplot2::margin()
{ggplot2}
object
library(figpatch)
library(ggplot2)
# Attach the fig image file
image <- system.file("extdata", "fig.png", package = "figpatch", mustWork = TRUE)
# Read in the image as a 'fig'
img <- fig(image)
img