ptt_plot_create_widget: Writes an html element for embedding, and optionally png...

View source: R/ptt_plot_widget.R

ptt_plot_create_widgetR Documentation

Writes an html element for embedding, and optionally png files.

Description

Writes an html element for embedding, and optionally png files.

Usage

ptt_plot_create_widget(
  p,
  title,
  filepath,
  render = T,
  self_contained = F,
  png_artefacts,
  png_folder,
  iframe_height = "550px"
)

Arguments

p

A plotly object.

title

The filename of the html element (without file format). The function will clean the name up, or try to extract it from param p if missing.

render

Logical. Is the plot rendered to viewer after saving the widget (default true). Returns the plot object nonetheless.

self_contained

Logical. Will the html artefact have self-contained dependencies, increasing size. Default false.

png_artefacts

Optional character vector of s(mall), n(arrow), and/or w(ide) corresponding to the expected .png sizes.

png_folder

A folder to save png-files.

path

The path of the saved file. When knitting and .Rmd file, the a folder is created matching the file name of the currently knit document and the path is set there.

iframe_heigh

A height of the iframe.

Value

The plotly object p.

Examples

p |> ptt_plot_create_widget()

pttry/pttrobo documentation built on March 5, 2025, 6:36 p.m.