Create example data
CREATE TABLE df AS
WITH t(x, y, id) AS (VALUES
(1.0, 1.0, 'A'),
(1.0, 3.0, 'A'),
(2.0, 1.0, 'A'),
(2.0, 3.0, 'B'),
(3.0, 1.0, 'B'),
(3.0, 3.0, 'B')
)
SELECT * FROM tggsql is still in early development and all functionality is subject to change. Read the alpha-release announcement
Layers are declared with the
DRAWclause. Read the documentation for this clause for a thorough description of how to use it.
Polygons can be used to draw arbitrary closed shapes based on an ordered sequence of x,y-coordinates. They are similar to paths, but close the shapes and fill the interior.
The following aesthetics are recognised by the polygon layer.
x): Position along the primary axis.y): Position along the secondary axis.stroke The colour of the contour lines.fill The colour of the inner area.colour Shorthand for setting stroke and fill simultaneously.opacity The opacity of colours.linewidth The width of the contour lines.linetype The dash pattern of the contour line.position: Position adjustment. One of 'identity' (default), 'stack', 'dodge', or 'jitter'The polygon layer does not transform its data but passes it through unchanged
The polygon layer has no orientation. The axes are treated symmetrically.
Simple example polygon.
Groups of individual polygons can be declared via PARTITION BY.
Invoking a group through discrete aesthetics works as well.