Exports a widget created by draw() (or any of the draw_*
functions) to a static file. Supports .svg for ECharts, Sigma networks, and MapLibre maps via Node.js
server-side rendering, including complete draw_panels() figures. Requires
a node binary on PATH.
Arguments
- widget
htmlwidget: A widget returned by
draw()or adraw_*function.- filename
Character scalar: Nonempty output path with an extension.
- width
Optional Numeric scalar
(0, Inf): Finite image width in pixels. Unset uses the widget's numeric width, or 800 for a relative/unspecified width.- height
Optional Numeric scalar
(0, Inf): Finite image height in pixels. Unset uses the widget's numeric height, or 600 for a relative/unspecified height.
Details
Callbacks under tooltips, axis pointers, and interactive toolbox controls are omitted. Other JavaScript callbacks are rejected because discarding them could change visible content. Built-in Gantt, dendrogram, and boxplot point renderers are shared with the browser widget and use JSON parameters. Networks share their deterministic layout and styles with the interactive widget. Maps share geometry, location joins, and color scales and use a Mercator projection. Exports show the initial configured view; browser camera changes and hover states are not stored in the R widget. SVG text remains editable. Network labels are fitted to the page and suppressed when they overlap.