By default, figure size of R Markdown is specified with inches. This function changes the default unit.

hook_figure_unit(unit = "mm", .set = TRUE)

Arguments

unit

A string of an unit (default: "mm"). Available units follow. measurements::conv_unit_options$length

.set

TRUE or FALSE to set the hook.

Value

invisible hook function

Details

As a side effect, fig.retina is set to NULL because of https://github.com/yihui/knitr/issues/1876.

Examples

hook_figure_unit('mm')
#> fig.retina is set NULL