vegalite: Create and (optionally) visualize a Vega-Lite spec

Description Usage Arguments References Examples

View source: R/vegalite.r

Description

Create and (optionally) visualize a Vega-Lite spec

Usage

1
2
3
4
vegalite(description = "", renderer = c("svg", "canvas"), export = FALSE,
  source = FALSE, editor = FALSE, viewport_width = NULL,
  viewport_height = NULL, background = NULL, time_format = NULL,
  number_format = NULL)

Arguments

description

a single element character vector that provides a description of the plot/spec.

renderer

the renderer to use for the view. One of canvas or svg (the default)

export

if TRUE the "Export as..." link will be displayed with the chart.(Default: FALSE.)

source

if TRUE the "View Source" link will be displayed with the chart. (Default: FALSE.)

editor

if TRUE the "Open in editor" link will be displayed with the cahrt. (Default: FALSE.)

viewport_width, viewport_height

height and width of the overall visualziation viewport. This is the overall area reserved for the plot. You can leave these NULL and use cell_size instead but you will want to configure both when making faceted plots.

background

plot background color. If NULL the background will be transparent.

time_format

the default time format pattern for text and labels of axes and legends (in the form of D3 time format pattern). Default: %Y-%m-%d

number_format

the default number format pattern for text and labels of axes and legends (in the form of D3 number format pattern). Default: s

References

Vega-Lite top-level config

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
dat <- jsonlite::fromJSON('[
    {"a": "A","b": 28}, {"a": "B","b": 55}, {"a": "C","b": 43},
    {"a": "D","b": 91}, {"a": "E","b": 81}, {"a": "F","b": 53},
    {"a": "G","b": 19}, {"a": "H","b": 87}, {"a": "I","b": 52}
  ]')

vegalite() %>%
  add_data(dat) %>%
  encode_x("a", "ordinal") %>%
  encode_y("b", "quantitative") %>%
  mark_bar()

Example output



vegalite documentation built on May 2, 2019, 10:46 a.m.