Learn R Programming

vchartr (version 0.1.4)

v_specs_legend: Set legend options

Description

Set legend options

Usage

v_specs_legend(vc, ..., add = FALSE)

Value

A vchart()

htmlwidget object.

Arguments

vc

An htmlwidget created with vchart().

...

Options for the legend, see examples or online documentation.

add

Add the legend to exiting ones or overwrite all previous legends.

Examples

Run this code
library(vchartr)
data("mpg", package = "ggplot2")

vchart(table(Class = mpg$class, Year = mpg$year)) %>%
  v_bar(aes(Class, Freq, fill = Year)) %>%
  v_specs_legend(
    title = list(text = "Title", visible = TRUE),
    orient = "right",
    position = "start",
    item = list(focus = TRUE)
  )

Run the code above in your browser using DataLab