Description Usage Arguments References Examples
axis_vl provide axis lines, ticks and labels to convey how a spatial range represents
a data range. Simply put, axes visualize scales.
By default, Vega-Lite automatically creates axes for x, y, row, and column channels
when they are encoded. Axis can be customized via the axis property of a channel
definition.
The axis_vl function works with all possible channels, but axis_x, axis_y, axis_facet_row
and axis_facet_col are offered as conveniences.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | axis_vl(vl, chnl = "x", domain = NULL, grid = NULL, maxExtent = NULL,
minExtent = NULL, orient = NULL, offset = NULL, position = NULL,
zindex = NULL, format = NULL, labels = NULL, labelAngle = NULL,
labelOverlap = NULL, labelPadding = NULL, ticks = NULL,
tickCount = NULL, tickSize = NULL, values = NULL, title = NULL,
titleMaxLength = NULL, titlePadding = NULL, remove = FALSE, ...)
axis_x(vl, ...)
axis_y(vl, ...)
axis_facet_col(vl, ...)
axis_facet_row(vl, ...)
|
vl |
Vega-Lite object |
chnl |
x, y, column, or row |
domain, grid, maxExtent, minExtent, orient, offset, position, zindex |
see axis docs |
format, labels, labelAngle, labelOverlap, labelPadding |
see axis docs |
ticks, tickCount, tickSize, values |
see axis docs |
title, titleMaxLength, titlePadding |
see axis docs |
remove |
see axis docs |
... |
deprecated arguments |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | vegalite() %>%
add_data("https://vega.github.io/vega-editor/app/data/population.json") %>%
add_filter("datum.year == 2000") %>%
calculate("gender", 'datum.sex == 2 ? "Female" : "Male"') %>%
encode_x("gender", "nominal") %>%
encode_y("people", "quantitative", aggregate="sum") %>%
encode_color("gender", "nominal") %>%
scale_x_ordinal_vl(range_step=8) %>%
scale_color_nominal_vl(range=c("#EA98D2", "#659CCA")) %>%
facet_col("age", "ordinal", padding=4) %>%
axis_x(remove=TRUE) %>%
axis_y(title="population", grid=FALSE) %>%
view_config(stroke_width=0) %>%
mark_bar()
vegalite() %>%
add_data("https://vega.github.io/vega-editor/app/data/population.json") %>%
add_filter("datum.year == 2000") %>%
calculate("gender", 'datum.sex == 2 ? "Female" : "Male"') %>%
encode_x("gender", "nominal") %>%
encode_y("people", "quantitative", aggregate="sum") %>%
encode_color("gender", "nominal") %>%
scale_x_ordinal_vl(range_step=8) %>%
scale_color_nominal_vl(range=c("#EA98D2", "#659CCA")) %>%
facet_col("age", "ordinal", padding=4) %>%
axis_x(remove=TRUE) %>%
axis_y(title="population", grid=FALSE) %>%
view_config(stroke_width=0) %>%
mark_bar()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.