g2_circle_packing: g2_circle_packing

View source: R/rg2.R

g2_circle_packingR Documentation

g2_circle_packing

Description

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

Usage

g2_circle_packing(data, colorField = NULL, sizeField = NULL, rawFields = NULL)

Arguments

data

required. Data frame for plot.

colorField

color field

sizeField

size field

rawFields

raw fields

See Also

Other g2: g2_area(), g2_bar(), g2_bidirectional_bar(), g2_box(), g2_bullet(), g2_chord(), g2_column(), g2_dual_axes(), g2_funnel(), g2_gauge(), g2_heatmap(), g2_histogram(), g2_line(), g2_liquid(), g2_pie(), g2_progress(), g2_radar(), g2_radial_bar(), g2_ring_progress(), g2_rose(), g2_sankey(), g2_scatter(), g2_stock(), g2_sunburst(), g2_tiny_area(), g2_tiny_column(), g2_treemap(), g2_venn(), g2_violin(), g2_waterfall(), g2_word_cloud(), g2()

Examples

jsonlite::fromJSON('https://gw.alipayobjects.com/os/antfincdn/%24m0nDoQYqH/basic-packing.json') |>
  g2_circle_packing() |>
  g2()

jsonlite::fromJSON('https://gw.alipayobjects.com/os/antfincdn/%24m0nDoQYqH/basic-packing.json') |>
  g2_circle_packing() |>
  g2_opt(
    label=FALSE,
    legend=FALSE,
    hierarchyConfig=list(sort=htmlwidgets::JS('(a, b) => b.depth - a.depth'))
  ) |>
  g2()

jsonlite::fromJSON('https://gw.alipayobjects.com/os/antvdemo/assets/data/flare.json') |>
  g2_circle_packing(sizeField = 'r',colorField = 'r') |>
  g2_opt(
    color='rgb(252, 253, 191)-rgb(231, 82, 99)-rgb(183, 55, 121)',
    pointStyle=list(
      stroke='rgb(183, 55, 121)',
      lineWidth= 0.5
    ),
    label=FALSE,
    legend=FALSE,
    drilldown=list(
      enabled=TRUE,
      breadCrumb= list(
        position='top-left'
      )
    )
  ) |>
  g2()


13kay/rg2 documentation built on Feb. 16, 2024, 10:22 p.m.