vw_autosize | R Documentation |
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.
vw_autosize(spec, width = NULL, height = NULL)
spec |
An object to be coerced to |
width |
|
height |
|
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.
S3 object with class vegaspec
Article on vegaspec (sizing), Vega documentation on sizing
vw_autosize(spec_mtcars, width = 350, height = 350)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.