Description Usage Arguments Details Value Examples
Given a chunk label, the figure file extension, the figure number(s), and the
chunk option fig.path, return the filename(s).
1 | fig_chunk(label, ext = "", number, fig.path = opts_chunk$get("fig.path"))
|
label |
The chunk label. |
ext |
The figure file extension, e.g. |
number |
The figure number (by default |
fig.path |
Passed to |
This function can be used in an inline R expression to write out the figure
filenames without hard-coding them. For example, if you created a plot in a
code chunk with the label foo and figure path ‘my-figure/’, you
are not recommended to use hard-coded figure paths like
\includegraphics{my-figure/foo-1.pdf} (in ‘.Rnw’ documents) or
 (R Markdown) in your document. Instead, you
should use \Sexpr{fig_chunk('foo', 'pdf')} or `).
You can generate plots in a code chunk but not show them inside the code
chunk by using the chunk option fig.show = 'hide'. Then you can use
this function if you want to show them elsewhere.
A character vector of filenames.
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.