Path

Layers are declared with the DRAW clause. Read the documentation for this clause for a thorough description of how to use it.

The path layer is used to create lineplots, but contrary to the line layer the data will not be connected along the x-axis. Instead records are connected in the order they appear in the data. Lines are divided due to their grouping, which is the combination of the discrete mapped aesthetics and the columns specified in the layers PARTITION BY.

Aesthetics

The following aesthetics are recognised by the path layer.

Required

  • x: Position along the x-axis
  • y: Position along the y-axis

Optional

  • colour/stroke: The colour of the path
  • opacity: The opacity of the path
  • linewidth: The width of the path
  • linetype: The type of path, i.e. the dashing pattern

Settings

  • position: Determines the position adjustment to use for the layer (default is 'identity')

Data transformation

The line layer does not transform its data but passes it through unchanged

Examples

Create example data
CREATE TABLE df AS
SELECT * FROM (VALUES
  (1.0, 1.0, 'A'),
  (2.0, 1.0, 'A'),
  (1.0, 3.0, 'A'),
  (3.0, 1.0, 'B'),
  (2.0, 3.0, 'B'),
  (3.0, 3.0, 'B'),
) AS t(x, y, id)

Simple example path.

VISUALISE x, y FROM df
  DRAW path

Contrary to line drawings, path is not forced to follow the order along the axis.

VISUALISE x, y FROM df
  DRAW path MAPPING 'Path' AS colour
  DRAW line MAPPING 'Line' AS colour

Groups of individual paths can be declared via PARTITION BY.

VISUALISE x, y FROM df
  DRAW path PARTITION BY id

Invoking a group through discrete aesthetics works as well.

VISUALISE x, y FROM df
  DRAW path MAPPING id AS colour

Compared to polygons, paths don’t close their shapes and fill their interiors.

VISUALISE x, y FROM df
  DRAW polygon MAPPING 'Polygon' AS stroke
  DRAW path MAPPING 'Path' AS stroke