VISUALISE FROM ggsql:penguins
DRAW point
MAPPING bill_len AS x, bill_dep AS y, species AS fillPoint
Layers are declared with the
DRAWclause. Read the documentation for this clause for a thorough description of how to use it.
The point layer is used to create scatterplots. The scatterplot is most useful for displaying the relationship between two continuous variables. A bubblechart is a scatterplot with a third variable mapped to the size of points.
Aesthetics
The following aesthetics are recognised by the point layer.
Required
x: Position along the x-axisy: Position along the y-axis
Optional
size: The size of each pointcolour: The default colour of each pointstroke: The colour of the stroke around each point (if any). Overridescolourfill: The fill colour of each point (if any). Overridescolouropacity: The opacity of the pointshape: The shape used to draw the point
Settings
position: Determines the position adjustment to use for the layer (default is'identity')
Data transformation
The point layer does not transform its data but passes it through unchanged
Examples
Create a classic scatterplot
Map to size to create a bubble chart
VISUALISE FROM ggsql:penguins
DRAW point
MAPPING bill_len AS x, bill_dep AS y, body_mass AS sizeUse filter to only plot a subset of the data
VISUALISE FROM ggsql:penguins
DRAW point
MAPPING bill_len AS x, bill_dep AS y, species AS fill
FILTER sex = 'female'VISUALISE species AS x, sex AS y, island AS fill FROM ggsql:penguins
DRAW point
SETTING position => 'jitter', distribution => 'normal'Use density distribution for a violin-like jitter effect, where jitter width scales with local data density.
VISUALISE species AS x, bill_dep AS y FROM ggsql:penguins
DRAW point SETTING position => 'jitter', distribution => 'density'