use_odg_graphic | R Documentation |
Similar to the usethis::use_*
functions, we want to
create a new ODG graphics object. This new graphics object
will be stored in a file which is copied from
a template from a given R-package. By default, the template
used is called 'odg_figure' from the rmdhelp package. Alternative
available templates are 'odg_draw_a4_landscape' and 'odg_draw_a4_portrait'
for a4-sized diagrams. After copying the template, it can be modified
using a pre-defined tool. By default this tool is LibreOffice draw.
use_odg_graphic(
ps_path,
ps_cwd = getwd(),
ps_rmd_src = NULL,
ps_odg_template = "odg_figure",
ps_template_package = "rmdhelp",
pb_recursive = TRUE,
pb_edit = TRUE,
pb_insert_include = TRUE
)
ps_path |
file name including path of ODG graphics object file |
ps_cwd |
current working directory |
ps_rmd_src |
explicit file name of rmd-source file |
ps_odg_template |
name of the template to be used |
ps_template_package |
package from which template should be taken from |
pb_recursive |
flag whether missing directory should be created |
pb_edit |
flag to indicate whether odg file should be opened |
pb_insert_include |
flag indicating whether graphic include command should be inserted into rmd source file |
After an odg graphic is created, the tags of the r-code-chunk are changed to invoke the hook-convert function that converts the odg file into pdf or a png graphic format. The hook function must be registered using a call to 'knitr::knit_hooks$set()'. See the examples section for more details.
s_odg_trg name of and path to the created odg graphics file
## Not run:
# register hook-convert function at beginning of document
knitr::knit_hooks$set(hook_convert_odg = rmdhelp::hook_convert_odg)
# ... more document content in between
# use the following call in a code-junk and directly evaluate the function call
rmdhelp::use_odg_graphic(ps_odg_file = "my_odg_graphic.odg")
# create a4-diagrams
rmdhelp::use_odg_graphic(ps_odg_file = "my_odg_graphic.odg",
ps_odg_template = "odg_draw_a4_portrait")
rmdhelp::use_odg_graphic(ps_odg_file = "my_odg_graphic.odg",
ps_odg_template = "odg_draw_a4_landscape")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.