Create example data
CREATE TABLE penguin_summary AS
SELECT
species,
MEAN(bill_dep) - STDDEV(bill_dep) AS low,
MEAN(bill_dep) AS mean,
MEAN(bill_dep) + STDDEV(bill_dep) AS high
FROM ggsql:penguins
GROUP BY speciesggsql 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.
Errorbars are used to display paired metrics, typically some interval, for a variable. It is displayed as a line between the two values, often with hinges at the ends.
The following aesthetics are recognised by the errorbar layer.
x or y: Position on the x- or y-axis. These are mutually exclusive.xmin or ymin: Position of one of the interval ends orthogonal to the main position. These are also mutually exclusive.xmax or ymax: Position of the other interval end orthogonal to the main position. These are also mutually exclusive.Note that the required aesthetics is either a set of {x, ymin, ymax} or {y, xmin, xmax} and not a combination of the two.
stroke/colour: The colour of the lines in the errorbar.opacity: The opacity of the colour.linewidth: The width of the lines in the errorbar.linetype: The dash pattern of the lines in the errorbar.width: The width of the hinges in points. Can be set to null to not display hinges.The errorbar layer does not transform its data but passes it through unchanged.
Classic errorbar with point at centre.
Dynamite plot using bars instead of points, using extra wide hinges.
The hinges can be omitted by setting null as width.