| vw_autosize {vegawidget} | R Documentation |
Autosize vegaspec
Description
The arguments width and height are used to override the width and height
of the provided spec, if the spec does not have multiple views.
The dimensions you provide describe the overall width and height of the
rendered chart, including axes, labels, legends, etc.
Usage
vw_autosize(spec, width = NULL, height = NULL)
Arguments
spec |
An object to be coerced to |
width |
|
height |
|
Details
In a Vega or Vega-Lite specification, the default interpretation
of width and height is to describe the dimensions of the
data rectangle, not including the space used by the axes, labels,
legends, etc. When width and height are specified using
autosize,
the meanings of width and height change to describe the dimensions
of the entire chart, including axes, labels, legends, etc.
There is an important limitation: specifying width and height is
effective only for single-view and layered specifications.
It will not work for specifications with multiple views
(e.g. hconcat, vconcat, facet, repeat); this will issue a
warning that there will be no effect on the specification when rendered.
Value
S3 object with class vegaspec
See Also
Article on vegaspec (sizing), Vega documentation on sizing
Examples
vw_autosize(spec_mtcars, width = 350, height = 350)