View source: R/chunk_templates.R
| tpl_plot_figure | R Documentation | 
Returns a character vector for the code chunk to plot a figure
tpl_plot_figure( chunk_label, figure_caption, figure_height, font_family = get_font_df()[["family"]], function_call = "RUBer::plot_figure", tab_placeholder = "PLACEHOLDER_TAB", suppress_warnings = FALSE )
| chunk_label | Character, chunk label | 
| figure_caption | Character, figure caption | 
| figure_height | Numeric, figure height in inches | 
| font_family | Character, the font family to use for all plots, defaults
to  | 
| function_call | Character, defaults to  | 
| tab_placeholder | Character, pandoc does not support the insertion of tabs, which is why a placeholder text is needed that will get replaced with tabs in post-processing, defaults to "PLACEHOLDER_TAB" | 
| suppress_warnings | Boolean, whether to suppress the warnings generated
by this code chunk, defaults to  | 
List of character vectors with chunk texts
# Returns code chunk as list
code_chunk_list <- tpl_plot_figure(
  chunk_label = 1L,
  figure_caption = "Caption for figure 1",
  figure_height = 4.2
)
# Unlist
code_chunk_vector <- unlist(
  code_chunk_list
)
# Display code chunks as they will be written to the Rmd
writeLines(
  code_chunk_vector
)
# The function is vectorized, so you can do this:
tpl_plot_figure(
  chunk_label = c(
    1L,
    2L
  ),
  figure_caption = c(
    "Caption for figure 1",
    "Caption for figure 2"
  ),
  figure_height = c(
    4.2,
    3.5
  )
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.