| opt | R Documentation |
G2 provides a Spec API which declares visualizations through a JavaScript object.
Options of G2 is a named list:
{
type: 'mark', // view, spaceLayer, ...
data: [],
encode: {},
scale: {},
transform: [],
coordinate: {},
style: {},
labelTransform: {},
title: {},
axis: {},
legend: {},
tooltip: {},
scrollbar: {},
slider: {},
interaction: {},
theme: {},
}
For the option with array value, you should use list(list(...), list(...))
to construct an array in JSON.
transform()
width |
optional default: 640 |
height |
optional default: 480 |
data |
required. Data Frame, URL of json/csv, for liquid data is a number, for gauge data is |
Spec: https://g2.antv.antgroup.com/en/spec/overview
g2_point(mtcars, 'drat', 'wt')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.