plot/lines

The plot/lines command takes an input data table, transforms it according to a user-provided scale configuration and then plots the data as one or more lines.

Syntax

lines (
data-x (...)
data-y (...)
color (...)
stroke-style (...)
stroke-width (...)
stroke-color (...)
marker-shape (...)
marker-size (...)
marker-color (...)
labels (...)
label-font-size (...)
label-color (...)
label-padding (...)
scale-x (...)
scale-y (...)
limit-x (...)
limit-x-min (...)
limit-x-max (...)
limit-y (...)
limit-y-min (...)
limit-y-max (...))

Options

data-x <dataset>

Set the 'x' dataset for the plot. The 'x' dataset will be used to calculate the horizontal position of geometry.

data-x (<values>...)
data-x (csv <file> <column>)
Examples:
;; list of static values
data-x (10px 20px 30px)

;; load a csv file
data-x (csv myfile.csv mycolumn)

data-y <dataset>

Set the 'y' dataset for the plot. The 'y' dataset will be used to calculate the vertical position of geometry.

data-y (<values>...)
data-y (csv <file> <column>)
Examples:
;; list of static values
data-y (10px 20px 30px)

;; load a csv file
data-y (csv myfile.csv mycolumn)

color <color>

Set the stroke and marker color.

color <color>
Examples:
;; set the color to grey
color #eee

;; set the color to red, 50% transparent
color (rgba 1 0 0 .5)

stroke-style <stroke_style>

Set the line's stroke style.

stroke-style (<stroke-style>)
Examples:
;; set the stroke to dashed
stroke-style dashed

stroke-width <stroke_width>

Set the line's stroke width.

stroke-width <measure>
Examples:
;; set the stroke width to 2pt
stroke-width 2pt

stroke-color <color>

Set the stroke color.

stroke-color <color>
Examples:
;; set the color to grey
stroke-color #eee

;; set the color to red, 50% transparent
stroke-color (rgba 1 0 0 .5)

marker-shape <marker_shape>

The plot/lines command takes an input data table, transforms it according to a user-provided scale configuration and then plots the data as one or more lines.

marker-size <size>

Set the marker size for the plot. If set to a value greater than zero, a 'marker' will be drawn for each point in the dataset at the points (x, y) coordinate.

marker-size <measure>
Examples:
;; set size to 2pt
marker-size 2pt

marker-color <color>

Set the marker color.

marker-color <color>
Examples:
;; set the color to grey
marker-color #eee

;; set the color to red, 50% transparent
marker-color (rgba 1 0 0 .5)

labels <dataset_string>

Set the labels dataset. If provided, a label will be drawn for each point in the dataset at the corresponding (x, y) coordinate. The number of entries in the 'labels' dataset must match the number of entries in the 'x' and 'y' datasets exactly.

labels (<values>...)
labels (csv <file> <column>)
Examples:
;; list of static values
labels ("A" "B" "C")

;; load a csv file
labels (csv myfile.csv mycolumn)

label-font-size <font_size>

Set the label font size.

label-font-size <measure>
Examples:
;; set the font size to 14pt
label-font-size 14pt

label-color <color>

Set the label color.

label-color <color>
Examples:
;; set the color to grey
label-color #eee

;; set the color to red, 50% transparent
label-color (rgba 1 0 0 .5)

label-padding <padding>

Set the label padding/spacing.

label-padding <measure>
Examples:
;; set the padding to 2em
label-padding 2em

scale-x <scale>

Set the type of the 'x' (horizontal) scale.

scale-x ([linear] [log] [logarithmic] [invert] [inverted])
List of scale types: - `linear` - Standard linear scale - `log`, `logarithmic` - Logarithmic (log10) scale - `invert`, `inverted` - Flip the scale
Examples:
;; set the scale to logarithmic mode
scale-x (log)

;; set the scale to inverted mode
scale-x (invert)

scale-y <scale>

Set the type of the 'y' (vertical) scale.

scale-y ([linear] [log] [logarithmic] [invert] [inverted])
List of scale types: - `linear` - Standard linear scale - `log`, `logarithmic` - Logarithmic (log10) scale - `invert`, `inverted` - Flip the scale
Examples:
;; set the scale to logarithmic mode
scale-y (log)

;; set the scale to inverted mode
scale-y (invert)

limit-x <limit>

Set the limits (minimum and maximum values) for the 'x' (horizontal) scale.

limit-x (<min> <max)
Examples:
;; set limits to [1..10]
limit-x (1 10)

limit-x-min <limit_min>

Set the minimum value (lower limit) for the 'x' (horizontal) scale.

limit-x-min <min>
Examples:
;; set the lower limit to 2
limit-x-min 2

limit-x-max <limit-max>

Set the maximum value (upper limit) for the 'x' (horizontal) scale.

limit-x-max <value>
Examples:
;; set the upper limit to 20
limit-x-max 20

limit-y <limit>

Set the limits (minimum and maximum values) for the 'y' (vertical) scale.

limit-y (<min> <max)
Examples:
;; set limits to [1..10]
limit-y (1 10)

limit-y-min <limit_min>

Set the minimum value (lower limit) for the 'y' (vertical) scale.

limit-y-min <min>
Examples:
;; set the lower limit to 2
limit-y-min 2

limit-y-max <limit-max>

Set the maximum value (upper limit) for the 'y' (vertical) scale.

limit-y-max <value>
Examples:
;; set the upper limit to 20
limit-y-max 20

Examples

Example: examples/charts-basic/linechart_timeseries


Edit this page on GitHub