Skip to content

Commit eb0f53b

Browse files
committed
updates based on review
1 parent fcb1b4d commit eb0f53b

25 files changed

Lines changed: 160 additions & 138 deletions

File tree

doc/syntax/clause/draw.qmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,6 @@ ORDER BY <column>, ...
9797
```
9898

9999
For some layers the order of records in the data is important, e.g. the path layer which connect records in the order they are provided. Since databases often doesn't guarantee a specific order of the data, the `ORDER BY` clause can be used to enforce such and order. Even for layers where the order doesn't immediately seem to matter it may have an effect, e.g. an overplottet scatterplot where the records in the end of the data are plottet on top of the one in the start.
100+
101+
## Layer orientation
102+
Some layer types treats the two axes differently. For instance, a boxplot has categories along a discrete axis and summary statistics along a continuous one. While we are used to seeing boxplots with categories along the x-axis, this is not a necessity and the orientation can be deduced directly from the mappings in the layer. So, if you map discrete data to the x axis and continuous data to the y axis you get a boxplot in the standard orientation, whereas if you switch the mapping the boxes will "lay down" instead. The vast majority of layers that has an orientation also has a unique mapping pattern that allows us to deduce the orientation directly from the mapping. The few layers where the mapping is ambiguous (e.g. `line`) has an `orientation` setting that allows you to set the orientation explicitly.

doc/syntax/layer/type/area.qmd

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ The following aesthetics are recognised by the area layer.
2222

2323
## Settings
2424
* `position`: Determines the position adjustment to use for the layer (default is `'stack'`)
25-
* `orientation`: The orientation of the layer. Either `'aligned'` (default), or `'transposed'`. Determines if the layers primary axis is aligned with the coordinate systems first axis or not
25+
* `orientation`: The orientation of the layer, see the [Orientation section](#orientation). One of the following:
26+
* `'aligned'` to align the layer's primary axis with the coordinate system's first axis.
27+
* `'transposed'` to align the layer's primary axis with the coordinate system's second axis.
2628

2729
## Data transformation
2830
The area layer sorts the data along its primary axis
@@ -77,3 +79,11 @@ An alternative is to center the stacks to create a steamgraph
7779
VISUALISE Date AS x, Value AS y, Series AS colour FROM long_airquality
7880
DRAW area SETTING position => 'stack', center => true
7981
```
82+
83+
You can combine this with the `orientation` setting to make a vertical steamgraph
84+
85+
```{ggsql}
86+
VISUALISE Date AS x, Value AS y, Series AS colour FROM long_airquality
87+
DRAW area
88+
SETTING position => 'stack', center => true, orientation => 'transposed'
89+
```

doc/syntax/layer/type/bar.qmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The bar layer has no required aesthetics
2727
* `width`: The width of the bars as a proportion of the available width
2828

2929
## Data transformation
30-
If the secondary axis has not been mapped the layer will calculate it for you.
30+
If the secondary axis has not been mapped the layer will calculate counts for you and display these as the secondary axis.
3131

3232
### Properties
3333

@@ -43,7 +43,7 @@ If the secondary axis has not been mapped the layer will calculate it for you.
4343
* `count AS <secondary axis>`: By default the barplot will show count as the height of the bars
4444

4545
## Orientation
46-
Bar plots have categories along their primary axis. The orientation can be deduced purely from the mapping. To create a horizontal bar plot you map the categories to `y` instead of `x` (assuming a default Cartesian coordinate system).
46+
Bar plots have categories along their primary axis. The orientation is deduced directly from the mapping. To create a horizontal bar plot you map the categories to `y` instead of `x` (assuming a default Cartesian coordinate system).
4747

4848
## Examples
4949

doc/syntax/layer/type/boxplot.qmd

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ The following aesthetics are recognised by the boxplot layer.
2929
* `width`: Relative width of the boxes. Defaults to `0.9`.
3030

3131
## Data transformation
32-
Per group, data will be divided into 4 quartiles and summary statistics will be derived from their extremes. Because number of observations per quartile may differ by one, the result of this approach may slightly differ from a pure quantile-based approach. The central line represents the median. The boxes are displayed from the 25th up to the 75th percentiles. The whiskers are calculated from the 25th/75th percentiles +/- the IQR times `coef`, but no more extreme than the data extrema. Observations are considered outliers when they are more extreme than the whiskers.
32+
Per group, data will be divided into 4 quartiles and summary statistics will be derived from their extremes.
33+
Because number of observations per quartile may differ by one, the result of this approach may slightly differ from a pure quantile-based approach.
34+
The central line represents the median.
35+
The boxes are displayed from the 25th up to the 75th percentiles.
36+
The whiskers are calculated from the 25th/75th percentiles +/- the IQR times `coef`, but no more extreme than the data extrema.
37+
Observations are considered outliers when they are more extreme than the whiskers.
3338

3439
### Calculated statistics
3540

@@ -77,12 +82,12 @@ Consider more observations as outliers by setting a smaller `coef`:
7782

7883
```{ggsql}
7984
VISUALISE FROM ggsql:penguins
80-
DRAW boxplot
85+
Create a horizontal boxplot by swapping `x` and `y`:
8186
MAPPING species AS x, bill_len AS y
8287
SETTING coef => 0.1
8388
```
8489

85-
Create a horizontal boxplot by swapping x and y:
90+
Create a horizontal boxplot by swapping `x` and `y`:
8691

8792
```{ggsql}
8893
VISUALISE FROM ggsql:penguins

doc/syntax/layer/type/density.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Visualise the distribution of a single continuous variable by computing a kernel
1010
The following aesthetics are recognised by the density layer.
1111

1212
### Required
13-
* Primary axis (e.g. `x`): The continuous variable to estimate density for.
13+
* Primary axis (e.g. `x`): The continuous variable for which to estimate density.
1414

1515
### Optional
1616
* `stroke`: The colour of the contour lines.

doc/syntax/layer/type/errorbar.qmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ The following aesthetics are recognised by the errorbar layer.
1111

1212
### Required
1313
* Primary axis (e.g. `x`): Position along the primary axis
14-
* Secondary axis min (e.g. `ymin`): Lower position along the secondary axis.
15-
* Secondary axis max (e.g. `ymax`): Upper position along the secondary axis.
14+
* Secondary axis minimum (e.g. `ymin`): Lower position along the secondary axis.
15+
* Secondary axis maximum (e.g. `ymax`): Upper position along the secondary axis.
1616

1717
### Optional
1818
* `stroke`/`colour`: The colour of the lines in the errorbar.
@@ -27,7 +27,7 @@ The following aesthetics are recognised by the errorbar layer.
2727
The errorbar layer does not transform its data but passes it through unchanged.
2828

2929
## Orientation
30-
Ribbon layers are sorted and connected along their primary axis. The orientation can be deduced purely from the mapping since interval is mapped to the secodnary axis. To create a vertical ribbon layer you map the independent variable to `y` instead of `x` and the interval to `xmin` and `xmax` (assuming a default Cartesian coordinate system).
30+
The orientation of errorbar layers is deduced directly from the mapping, because the interval is mapped to the secondary axis. To create a horizontal errorbar layer, you map the independent variable to `y` instead of `x` and the interval to `xmin` and `xmax` (assuming a default Cartesian coordinate system).
3131

3232
## Examples
3333

doc/syntax/layer/type/histogram.qmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ The histogram layer will bin the records in each group and count them. By defaul
4343
* `count AS <secondary axis>`: By default the histogram will show count as the height of the bars
4444

4545
## Orientation
46-
The histogram has its primary axis along the binned variable. The orientation can be deduced from the mapping. To create a horizontal histogram you map the variable to `y` instead of `x` (assuming a default Cartesian coordinate system).
46+
The histogram has its primary axis along the binned variable. The orientation is deduced directly from the mapping. To create a horizontal histogram, you map the variable to `y` instead of `x` (assuming a default Cartesian coordinate system).
4747

4848
## Examples
4949

@@ -90,7 +90,7 @@ DRAW histogram
9090
SETTING binwidth => 100
9191
```
9292

93-
Create a horizontal histogram by changing the mapping
93+
Create a histogram along the y axis by changing the mapping
9494

9595
```{ggsql}
9696
VISUALISE FROM ggsql:penguins

doc/syntax/layer/type/line.qmd

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ The following aesthetics are recognised by the line layer.
2121

2222
## Settings
2323
* `position`: Determines the position adjustment to use for the layer (default is `'identity'`)
24-
* `orientation`: The orientation of the layer. Either `'aligned'` (default), or `'transposed'`. Determines if the layers primary axis is aligned with the coordinate systems first axis or not
24+
* `orientation`: The orientation of the layer, see the [Orientation section](#orientation). One of the following:
25+
* `'aligned'` to align the layer's primary axis with the coordinate system's first axis.
26+
* `'transposed'` to align the layer's primary axis with the coordinate system's second axis.
2527

2628
## Data transformation
27-
The line layer sorts the data along its primary axis
29+
The line layer sorts the data along its primary axis.
2830

2931
## Orientation
30-
Line plots are sorted and connected along their primary axis. Since the primary axis cannot be deduced from the mapping it must be specified using the `orientation` setting. E.g. if you wish to create a vertical line plot you need to set `orientation => 'transposed'` to indicate that the primary layer axis follows the second axis of the coordinate system.
32+
Line plots are sorted and connected along their primary axis. Since the primary axis cannot be deduced from the mapping it must be specified using the `orientation` setting. If you wish to create a vertical line plot, you need to set `orientation => 'transposed'` to indicate that the primary layer axis follows the second axis of the coordinate system.
3133

3234
## Examples
3335

doc/syntax/layer/type/linear.qmd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ The following aesthetics are recognised by the abline layer.
2929
* `linetype`: The type of the line, i.e. the dashing pattern
3030

3131
## Settings
32-
* `orientation`: The orientation of the layer. Either `'aligned'` (default), or `'transposed'`. Determines if the layers primary axis ($x$ in the equation) is aligned with the coordinate systems first axis or not
32+
* `orientation`: The orientation of the layer, see the [Orientation section](#orientation). One of the following:
33+
* `'aligned'` to align the layer's primary axis with the coordinate system's first axis.
34+
* `'transposed'` to align the layer's primary axis with the coordinate system's second axis.
3335

3436
## Data transformation
3537
The linear layer does not transform its data but passes it through unchanged.
3638

3739
## Orientation
38-
Linear layers uses the predictor ($x$) for their primary axis and the response $y$ for its secondary axis. Since the primary axis cannot be deduced from the mapping it must be specified using the `orientation` setting. E.g. if you wish to create a vertical linear plot you need to set `orientation => 'transposed'` to indicate that the primary layer axis follows the second axis of the coordinate system.
40+
Linear layers use the predictor ($x$) for their primary axis and the response $y$ for its secondary axis. Since the primary axis cannot be deduced from the mapping it must be specified using the `orientation` setting. E.g. to create a vertical linear plot, you need to set `orientation => 'transposed'` to indicate that the primary layer axis follows the second axis of the coordinate system.
3941

4042
## Examples
4143

doc/syntax/layer/type/path.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The following aesthetics are recognised by the path layer.
2626
The path layer does not transform its data but passes it through unchanged
2727

2828
## Orientation
29-
The path layer is symmetric in how it regards its axes and thus doesn't exhibit any orientation.
29+
The path layer has no orientation. The axes are treated symmetrically.
3030

3131
## Examples
3232

0 commit comments

Comments
 (0)