v_radar: Create a Radar Chart

View source: R/layers.R

v_radarR Documentation

Create a Radar Chart

Description

Create a Radar Chart

Usage

v_radar(
  vc,
  mapping = NULL,
  data = NULL,
  name = NULL,
  ...,
  serie_id = NULL,
  data_id = NULL
)

Arguments

vc

A chart initialized with vchart().

mapping

Default list of aesthetic mappings to use for chart.

data

Default dataset to use for chart. If not already a data.frame, it will be coerced to with as.data.frame.

name

Name for the serie, only used for single serie (no color/fill aesthetic supplied).

...

Additional parameters for the serie.

data_id, serie_id

ID for the data/serie, can be used to further customize the chart with v_specs().

Value

A vchart() htmlwidget object.

Examples


library(vchartr)

# Default radar chart
subset(electricity_mix, country == "Germany") %>%
  vchart() %>%
  v_radar(aes(source, generation))

# Without area
subset(electricity_mix, country == "Germany") %>%
  vchart() %>%
  v_radar(
    aes(source, generation),
    area = list(visible = FALSE)
  )


# Mutliple series
subset(electricity_mix, country %in% c("Germany", "Canada")) %>%
  vchart() %>%
  v_radar(aes(source, generation, color = country))



# Custom axes
subset(electricity_mix, country == "Germany") %>%
  vchart() %>%
  v_radar(aes(source, generation)) %>%
  v_scale_y_continuous(min = 0, max = 200)

subset(electricity_mix, country == "Germany") %>%
  vchart() %>%
  v_radar(aes(source, generation)) %>%
  v_scale_y_continuous(
    grid = list(smooth = FALSE),
    domainLine = list(visible = FALSE)
  ) %>%
  v_scale_x_discrete(
    label = list(space = 20),
    domainLine = list(visible = FALSE)
  )

vchartr documentation built on April 12, 2025, 1:51 a.m.