Join us for
RADAR: AI Edition

vegalite (version 0.6.1)

mark_line: Line mark

Description

A line mark represents the data points stored in a field with a line connecting all of these points. Unlike other marks except area that represents one data element per mark, one line mark represent multiple data element as a single line.

Usage

mark_line(vl, orient = NULL, interpolate = NULL, tension = NULL, opacity = NULL, color = NULL, fill = NULL, stroke = NULL)

Arguments

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.
interpolate
The line interpolation method to use. One of linear step-before, step-after, basis, basis-open, basis-closed, bundle, cardinal, cardinal-open, cardinal-closed, monotone. For more information about each interpolation method, please see D3’s line interpolation.
tension
Depending on the interpolation type, sets the tension parameter. (See D3’s line interpolation.)
opacity
0.0-1.0
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.

References

Vega-Lite Mark spec

Examples

Run this code
vegalite() %>%
  cell_size(300, 300) %>%
  add_data("https://vega.github.io/vega-editor/app/data/driving.json") %>%
  encode_x("miles", "quantitative") %>%
  encode_y("gas", "quantitative") %>%
  encode_path("year", "temporal") %>%
  scale_x_linear(zero=FALSE) %>%
  scale_y_linear(zero=FALSE) %>%
  mark_line()

Run the code above in your browser using DataLab