vega_embed {vegawidget}R Documentation

Vega embed options

Description

Helper-function to specify the embed argument to vegawidget(). These arguments reflect the options to the vega-embed library, which ultimately renders the chart specification as HTML.

Usage

vega_embed(
  renderer = c("canvas", "svg"),
  actions = NULL,
  defaultStyle = TRUE,
  config = NULL,
  patch = NULL,
  bind = NULL,
  ...
)

Arguments

renderer

character the renderer to use for the view. One of "canvas" (default) or "svg". See Vega docs for details.

actions

logical or named vector of logicals, determines if action links ("Export as PNG/SVG", "View Source", "Open in Vega Editor") are included with the embedded view. If the value is TRUE (default), all action links will be shown and none if the value is FALSE. This property can be a named vector of logicals that maps keys (export, source, compiled, editor) to logical values for determining if each action link should be shown. By default, export, source, and editor are TRUE and compiled is FALSE, but these defaults can be overridden. For example, if actions is list(export = FALSE, source = TRUE), the embedded visualization will have two links – "View Source" and "Open in Vega Editor".

defaultStyle

logical or character default stylesheet for embed actions. If set to TRUE (default), the embed actions are shown in a menu. Set to FALSE to use simple links. Provide a character string to set the style sheet.

config

character or list, a URL string from which to load a Vega/Vega-Lite or Vega-Lite configuration file, or a list of Vega/Vega-Lite configurations to override the default configuration options. If config is a URL, it will be subject to standard browser security restrictions. Typically this URL will point to a file on the same host and port number as the web page itself.

patch

JS function, list or character, A function to modify the Vega specification before it is parsed. Alternatively, an list that, when compiled to JSON, will meet JSON-Patch RFC6902. If you use Vega-Lite, the compiled Vega will be patched. Alternatively to the function or the list, a URL string from which to load the patch can be provided. This URL will be subject to standard browser security restrictions. Typically this URL will point to a file on the same host and port number as the web page itself.

bind

character

...

other named items, outlined in vega-embed options.

Details

The most important arguments are renderer, actions, and defaultStyle:

The vega-embed library has a lot more options, you can supply these as names arguments using ....

For example, it is ineffective to set the width and height parameters here when embedding a Vega-Lite specification, as they will be overridden by the value in the chart specification.

Value

list to to be used with vega-embed JavaScript library

See Also

vega-embed library, vegawidget()

Examples

vega_embed(renderer = "svg")


[Package vegawidget version 0.5.0 Index]