vegalite {vegalite} | R Documentation |
Create and (optionally) visualize a Vega-Lite spec
Description
Create and (optionally) visualize a Vega-Lite spec
Usage
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 |
export |
if |
source |
if |
editor |
if |
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 |
background |
plot background color. If |
time_format |
the default time format pattern for text and labels of
axes and legends (in the form of D3 time format pattern).
Default: |
number_format |
the default number format pattern for text and labels of
axes and legends (in the form of
D3 number format pattern).
Default: |
References
Examples
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()