extract.fig.params: Extract figure parameters from code chunks.

Description Usage Arguments Details

Description

extract.fig.params extracts figure width and height from code chunks

Usage

1

Arguments

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

Details

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)


vladchimescu/RdocsJupyter documentation built on May 3, 2019, 6:15 p.m.