Description Usage Arguments References Examples
A bar mark represents each data point as a rectangle, where the length is mapped to a quantitative scale.
1 2 |
vl |
Vega-Lite object |
orient |
the orientation of a non-stacked bar, area, and line charts. The value is either "horizontal", or "vertical" (default). For bar and tick, this determines whether the size of the bar and tick should be applied to x or y dimension. For area, this property determines the orient property of the Vega output. For line, this property determines the path order of the points in the line if path channel is not specified. For stacked charts, this is always determined by the orientation of the stack; therefore explicitly specified value will be ignored. |
stack |
stacking modes for bar and area marks. |
size |
The pixel area each the point. For example: in the case of circles, the radius is determined in part by the square root of the size value. |
opacity |
|
filled |
whether the shape's color should be used as fill color instead of stroke color. |
color |
color of the mark – either fill or stroke color based on the filled mark config. |
fill |
fill color. This config will be overridden by color channel’s specified or mapped values if filled is true. |
stroke |
stroke color. This config will be overridden by color channel’s specified or mapped values if filled is false. |
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()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.