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)ggsql is still in early development and all functionality are subject to change
Layers are declared with the
DRAWclause. 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.
The following aesthetics are recognised by the path layer.
x: Position along the x-axisy: Position along the y-axiscolour/stroke: The colour of the pathopacity: The opacity of the pathlinewidth: The width of the pathlinetype: The type of path, i.e. the dashing patternposition: Determines the position adjustment to use for the layer (default is 'identity')The line layer does not transform its data but passes it through unchanged
Simple example path.
Contrary to line drawings, path is not forced to follow the order along the axis.
Groups of individual paths can be declared via PARTITION BY.
Invoking a group through discrete aesthetics works as well.
Compared to polygons, paths don’t close their shapes and fill their interiors.