loading...

A caption for a figure can be created in two ways: either directly when you provide both text= and image=, or indirectly, when you call Figure() within an R chunk with image= not provided. In that case, the caption is saved for later use, and fig() retrieves it when needed. The label of the figure is automatically set to the label of the chunk.

Figure(text = NULL, image = NULL, label = NULL, hold = NULL)

fig(..., hold = FALSE)

fig_id(label = NULL)

Arguments

text

The text of the caption. It can contain Markdown formatting.

image

The Markdown code to include a figure like ![alt](path/to/figure.png), see example.

label

The label to use (not required if the function is run from within an R chunk because the chunk label is used by default).

hold

Should we save the caption for later use, and return invisibly? Default value is FALSE if image= is provided or the function is not called from within an R chunk.

...

Same arguments as for Figure().

Value

The caption with a code to number the figure is returned (invisibly, if hold = TRUE).

Examples

Figure("The official R logo.", " ![R logo](https://www.r-project.org/logo/Rlogo.png){width='80%'} ")
#>