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

Description Usage Arguments References Examples

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, padding = NULL, autosize = 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 view_size instead but you will want to configure both when making faceted plots.

padding

single number to be applied to all sides, or list specifying padding on each side, e.g list("top" = 5, "bottom" = 3, "left" = 2, "right" = 2). Unit is pixels.

autosize

sizing setting (autosize)

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

...

additional arguments

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()

hrbrmstr/vegalite documentation built on May 17, 2019, 5:38 p.m.