opt | R Documentation |
opt param in rg2 is the PlotOptions for G2Plot.
You can construct an opt using function with g2_
prefix and g2_opt()
.
https://g2plot.antv.antgroup.com/en/api for details
width |
optional number default: 400. width of the chart. |
height |
optional number default: 400. height of the chart. |
data |
required. Data frame for plot. |
reflect |
Apply reflect transform to the coordinate of line plot. When reflect: 'y' is set, y-axis can be inverted; in the same way, you can set reflect: 'x' to invert x-axis, and invert x-axis and y-axis at the same time is also supported with 'c('x','y')'. |
xField |
The name of the data field corresponding to the graph in the x direction, usually the field corresponding to the horizontal coordinate axis. For example, to see how many people are in different classes, the class field is the corresponding xField. |
yField |
The name of the data field corresponding to the graph in the y direction, usually the field corresponding to the vertical coordinate axis. For example, to see the number of students in different classes, the number field is the corresponding yField. |
seriesField |
grouping field |
groupField |
grouping field |
stackField |
stack field |
sizeField |
size field |
shapeField |
shape field |
colorField |
color field |
angleField |
angle field |
binField |
bin field |
setsField |
sets field |
outliersField |
outliers field |
measureField |
measure field |
rangeField |
range field |
sourceField |
source field |
targetField |
target field |
wordField |
word field |
weightField |
weight field |
rawFields |
raw fields |
compareField |
compare field |
percent |
percent |
smooth |
TRUE/FALSE. whether the curve is smooth. |
isStack |
to stack charts |
isGroup |
to group charts |
isPercent |
to percent charts |
isRange |
to range charts |
g2_scatter(mtcars, 'drat', 'wt') |>
g2_opt(shape='circle', theme='dark') |>
g2()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.