Point

Layers are declared with the DRAW clause. 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-axis
  • y: Position along the y-axis

Optional

  • size: The size of each point
  • colour: The default colour of each point
  • stroke: The colour of the stroke around each point (if any). Overrides colour
  • fill: The fill colour of each point (if any). Overrides colour
  • opacity: The opacity of the point
  • shape: The shape used to draw the point

Settings

The point layer has no additional settings

Data transformation

The point layer does not transform its data but passes it through unchanged

Examples

Create a classic scatterplot

VISUALISE FROM ggsql:penguins
DRAW point
    MAPPING bill_len AS x, bill_dep AS y, species AS fill
    SETTING size => 30

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 size

Use 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
    SETTING size => 30
    FILTER sex = 'female'