Create example data
CREATE TABLE df AS
SELECT * FROM (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'),
) 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.
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 x-axis.y Position along the y-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: Determines the position adjustment to use for the layer (default is 'identity')The polygon layer does not transform its data but passes it through unchanged
Simple example polygon.
Groups of individual polygons can be declared via PARTITION BY.
Invoking a group through discrete aesthetics works as well.