knit_print.vegaspec {vegawidget}R Documentation

Knit-print method

Description

If you are knitting to an HTML-based format, the only supported options are vega.width, vega.height (as pixels) and vega.embed (as a list). If you are knitting to a non-HTML-based format, you additionally have the options dev, out.width and out.height available.

Usage

knit_print.vegaspec(spec, ..., options = NULL)

Arguments

spec

An object to be coerced to vegaspec, a Vega/Vega-Lite specification

...

other arguments

options

list, knitr options

Details

The biggest thing to keep in mind about a Vega visualization is that very often, the chart tells you how much space it needs, rather than than you tell it how much space it has available. In the future, it may reveal itself how to manage better this "conversation".

HTML-based

When knitting to an HTML-based format, the spec is rendered as normal, it calls vegawidget() using the options vega.width, vega.height and vega.embed:

Non-HTML-based

When knitting to an non-HTML-based format, e.g. github_document or pdf_document, this function will convert the chart to an image, then knitr will incorporate the image into your document. You have the additional knitr options dev, out.width, and out.height:

See Also

vw_autosize(), vega_embed()


[Package vegawidget version 0.5.0 Index]