opt: G2 options

optR Documentation

G2 options

Description

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()

Arguments

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 ⁠list(value=list(target=200, total=400, percent=0.5,thresholds=c(...) name="score"))⁠

Details

Spec: https://g2.antv.antgroup.com/en/spec/overview

Examples

g2_point(mtcars, 'drat', 'wt')


13kay/rg2 documentation built on June 25, 2024, 7:26 a.m.