You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/syntax/layer/type/bar.qmd
+15-4Lines changed: 15 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -13,8 +13,8 @@ The following aesthetics are recognised by the bar layer.
13
13
The bar layer has no required aesthetics
14
14
15
15
### Optional
16
-
*`x`: Position on the x-axis. If missing all records will be shown in the same bar
17
-
*`y`: The height of the plot. If missing, it will be calculated by the layer
16
+
*Primary axis (e.g. `x`): The categories to create bars for. If missing all records will be shown in the same bar
17
+
*Secondary axis (e.g. `y`): The height of the bars. If missing, it will be calculated by the layer
18
18
*`colour`: The default colour of each bar
19
19
*`stroke`: The colour of the stroke around each bar. Overrides `colour`
20
20
*`fill`: The fill colour of each bar. Overrides `colour`
@@ -27,7 +27,7 @@ The bar layer has no required aesthetics
27
27
*`width`: The width of the bars as a proportion of the available width
28
28
29
29
## Data transformation
30
-
If `y` has not been mapped the layer will calculate it for you.
30
+
If the secondary axis has not been mapped the layer will calculate it for you.
31
31
32
32
### Properties
33
33
@@ -40,7 +40,10 @@ If `y` has not been mapped the layer will calculate it for you.
40
40
41
41
### Default remappings
42
42
43
-
*`count AS y`: By default the barplot will show count as the height of the bars
43
+
*`count AS <secondary axis>`: By default the barplot will show count as the height of the bars
44
+
45
+
## 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).
44
47
45
48
## Examples
46
49
@@ -100,3 +103,11 @@ SCALE BINNED x
100
103
And use with a polar coordinate system to create a pie chart
101
104
102
105
**TBD**
106
+
107
+
Create a horizontal bar plot by changing the mapping
Copy file name to clipboardExpand all lines: doc/syntax/layer/type/boxplot.qmd
+14-3Lines changed: 14 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -9,8 +9,8 @@ Boxplots display a summary of a continuous distribution. In the style of Tukey,
9
9
The following aesthetics are recognised by the boxplot layer.
10
10
11
11
### Required
12
-
*`x`: Position on the x-axis
13
-
*`y`: Position on the y-axis
12
+
*Primary axis (e.g. `x`): The categorical variable to group by
13
+
*Secondary axis (e.g. `y`): The continuous variable to summarize
14
14
15
15
### Optional
16
16
*`stroke`: The colour of the box contours, whiskers, median line and outliers.
@@ -43,7 +43,10 @@ Observations are considered outliers when they are more extreme than the whisker
43
43
44
44
### Default remapping
45
45
46
-
*`value AS y`: By default the values are displayed along the y-axis.
46
+
*`value AS <secondary axis>`: By default the values are displayed along the secondary axis.
47
+
48
+
## Orientation
49
+
The boxplot has its categorical groups along the primary axis and the continuous values along the secondary axis. The orientation can be deduced from the scale types or from the mapping. To create a horizontal boxplot, map the categorical variable to `y` and the continuous variable to `x` (assuming a default Cartesian coordinate system).
Copy file name to clipboardExpand all lines: doc/syntax/layer/type/density.qmd
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ Visualise the distribution of a single continuous variable by computing a kernel
10
10
The following aesthetics are recognised by the density layer.
11
11
12
12
### Required
13
-
*`x`: Position on the x-axis.
13
+
*Primary axis (e.g. `x`): The continuous variable to estimate density for.
14
14
15
15
### Optional
16
16
*`stroke`: The colour of the contour lines.
@@ -62,7 +62,10 @@ $$
62
62
63
63
### Default remappings
64
64
65
-
*`density AS y`: By default the density layer will display the computed density along the y-axis.
65
+
*`density AS <secondary axis>`: By default the density layer will display the computed density along the secondary axis.
66
+
67
+
## Orientation
68
+
The density has its primary axis along the variable for which density is computed. The orientation can be deduced from the mapping. To create a horizontal density plot, map the variable to `y` instead of `x` (assuming a default Cartesian coordinate system).
Copy file name to clipboardExpand all lines: doc/syntax/layer/type/histogram.qmd
+14-3Lines changed: 14 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,13 @@ title: "Histogram"
4
4
5
5
> Layers are declared with the [`DRAW` clause](../../clause/draw.qmd). Read the documentation for this clause for a thorough description of how to use it.
6
6
7
-
Visualise the distribution of a single continuous variable by dividing the x axis into bins and counting the number of observations in each bin. If providing a weight then a weighted histogram is calculated instead.
7
+
Visualise the distribution of a single continuous variable by dividing the primary axis into bins and counting the number of observations in each bin. If providing a weight then a weighted histogram is calculated instead.
8
8
9
9
## Aesthetics
10
10
The following aesthetics are recognised by the bar layer.
11
11
12
12
### Required
13
-
*`x`: Position on the x-axis
13
+
*Primary axis (e.g. `x`): The continuous variable to bin
14
14
15
15
### Optional
16
16
*`colour`: The default colour of each bar
@@ -40,7 +40,10 @@ The histogram layer will bin the records in each group and count them. By defaul
40
40
41
41
### Default remappings
42
42
43
-
*`count AS y`: By default the histogram will show count as the height of the bars
43
+
*`count AS <secondary axis>`: By default the histogram will show count as the height of the bars
44
+
45
+
## 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).
44
47
45
48
## Examples
46
49
@@ -86,3 +89,11 @@ DRAW histogram
86
89
MAPPING body_mass AS x
87
90
SETTING binwidth => 100
88
91
```
92
+
93
+
Create a horizontal histogram by changing the mapping
Copy file name to clipboardExpand all lines: doc/syntax/layer/type/ribbon.qmd
+6-3Lines changed: 6 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,9 @@ The ribbon layer is used to display extrema over a sorted x-axis. It can be seen
10
10
The following aesthetics are recognised by the ribbon layer.
11
11
12
12
### Required
13
-
*`x`: Position along the x-axis
14
-
*`ymin`: Lower position along the y-axis.
15
-
*`ymax`: Upper position along the y-axis.
13
+
*Primary axis (e.g. `x`): Position along the primary (domain) axis
14
+
*Secondary axis min (e.g. `ymin`): Lower position along the secondary (value) axis.
15
+
*Secondary axis max (e.g. `ymax`): Upper position along the secondary (value) axis.
16
16
17
17
### Optional
18
18
*`stroke`: The colour of the contour lines.
@@ -27,6 +27,9 @@ The following aesthetics are recognised by the ribbon layer.
27
27
## Data transformation
28
28
The ribbon layer does not transform its data but passes it through unchanged.
29
29
30
+
## Orientation
31
+
The ribbon has its domain axis as the primary axis and the value range on the secondary axis. The orientation can be deduced from the mapping. To create a horizontal ribbon, map the domain to `y` and use `xmin`/`xmax` for the value range (assuming a default Cartesian coordinate system).
32
+
30
33
## Examples
31
34
32
35
A ribbon plot with arbitrary values as minima/maxima
Copy file name to clipboardExpand all lines: doc/syntax/layer/type/violin.qmd
+12-2Lines changed: 12 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -11,8 +11,8 @@ The violins are mirrored kernel density estimates, similar to the [density](dens
11
11
The following aesthetics are recognised by the violin layer.
12
12
13
13
### Required
14
-
*`x`: Position on the x-axis (categorical).
15
-
*`y`: Value on the y-axis for which to compute density.
14
+
*Primary axis (e.g. `x`): The categorical variable for grouping.
15
+
*Secondary axis (e.g. `y`): The continuous variable to compute density for.
16
16
17
17
### Optional
18
18
*`stroke`: The colour of the contour lines.
@@ -52,6 +52,9 @@ The major difference between a violin layer and a density layer is just the matt
52
52
53
53
*`density AS offset`: By default the offsets around a centerline reflect the computed density.
54
54
55
+
## Orientation
56
+
The violin plot has its categorical groups along the primary axis and the continuous values along the secondary axis. The orientation can be deduced from the scale types or from the mapping. To create horizontal violins, swap `x` and `y` in the mapping (assuming a default Cartesian coordinate system).
57
+
55
58
## Examples
56
59
57
60
A typical violin plot.
@@ -83,3 +86,10 @@ VISUALISE species AS x, bill_dep AS y, island AS fill FROM ggsql:penguins
83
86
DRAW violin
84
87
```
85
88
89
+
Create horizontal violins by swapping x and y:
90
+
91
+
```{ggsql}
92
+
VISUALISE species AS y, bill_dep AS x FROM ggsql:penguins
0 commit comments