Description Usage Arguments Details
extract.fig.params
extracts figure width and height from
code chunks
1 | extract.fig.params(filename, type)
|
filename |
File name of the vignette. Absolute path has to be prepended if the document is not in R working directory |
type |
Vignette type. Valid values are "Rmd" for R markdown and "Rnw" for Sweave and knitr vignette |
The function extracts figure parameters from code chunks and
places these figure options right before the code chunk, from which the
figure dimensions were read out.
Suppose, there is a code chunk
in which a figure is plotted and the figure's width and height are set as follows:
<<someplot, fig.width=6, fig.height=4.5>>=
plot(x, f(x))
@
The function extract.fig.params
would extract width and height
and pass them to set_plot_options
function from package IRkernel.
Thus the former code chunk will be preceded by the following :
<<>>=
IRkernel::set_plot_options(width = 6, height = 4.5)
@
The purpose of this code chunk is to make sure the aspect ratio of the
figure is communicated to Jupyter Notebook via R kernel (IRkernel)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.