fig | R Documentation |
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 |
Path to image file. |
aspect.ratio |
Manually override the image's aspect ratio or set "free" to allow fig to be resized by patchwork. |
link_dim |
Logical, whether to lock the dimensions & aspect.ratio of the aligned plots to that of this fig. |
b_col |
Colour of the border line. |
b_size |
Size of the border line. |
b_pos |
Whether the border is 'offset' (expands out from figure) or 'inset' and expands inwards, partially covering up the figure. |
b_margin |
Margin around the fig. Use |
{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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.