Skip to content

Commit 4f8f280

Browse files
authored
Docs for palettes and aes (#108)
1 parent c6c7a2f commit 4f8f280

120 files changed

Lines changed: 3221 additions & 47 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

doc/_quarto.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,14 @@ website:
8585
- section: Types
8686
contents:
8787
- auto: syntax/scale/type/*
88-
- section: Palettes
88+
- section: Aesthetics
8989
contents:
90-
- auto: syntax/scale/palette/*
90+
- auto: syntax/scale/aesthetic/*
9191

9292

9393
format:
9494
html:
95+
lightbox: auto
9596
syntax-definitions:
9697
- ggsql.xml
9798
theme:
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: "Position"
3+
---
4+
5+
Position aesthetics (`x` and `y`, plus all their variants) relate data to placement in the coordinate system of the plot. All layers need at least one of each positional aesthetic mapped in order to show its data. However, the layer may compute positional aesthetics from the mapping. For example, a bar plot calculates the `y` aesthetic by counting the number of records in each group.
6+
7+
## Literal values
8+
Scales for position aesthetics never use an output range and always relate to the input range. This is a practical decision by ggsql because different writers may treat the positional aesthetic in different ways. ^[In reality one could easily think of positional literal values as either normalized position along the x or y axis, or absolute units of distance from the bottom left corner of the coordinate system.]
9+
10+
::: {.callout-note}
11+
The lack of true literal values in position means that it is currently hard to place data and annotation "in-between" breaks in a discrete position scale.
12+
:::
13+
14+
## Aesthetic families
15+
Positional aesthetics consist of two families: The `x` and `y` family. Each of these consist of their primary aesthetic along with a range of sub aesthetic defined by their suffix:
16+
17+
* `2`
18+
* `end`
19+
* `min`
20+
* `max`
21+
22+
Which version of aesthetic to use depends on the layer, but all aesthetics within a family is scaled by the same scale, which is named after its primary aesthetic. This means that even when rendering a layer that only uses `xmin` and `xmax`, you will still scale it by writing `SCALE x ...` and label it by writing `LABEL x => ...`
23+
24+
## Coordinate system
25+
Another thing that makes positional aesthetics different from other aesthetic is that they are dependent on a coordinate system which takes position scales and defines how values should be converted to a location on a plane. The default Cartesian coordinate system does what is generally expected: it places points along two perpendicular axes in a 2D plane. Other systems such as polar coordinates may dramatically change the look of a layer, transforming both the straightness of lines and positional relation of data.

doc/syntax/scale/aesthetic/1_color.qmd

Lines changed: 289 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: Opacity
3+
---
4+
5+
The `opacity` aesthetic governs how opaque objects are (or, conversely, how transparent they are). Depending on the layer it controls the opacity of the fill *or* stroke (if a layer has a natural fill then that is what receives the opacity). Opacity goes from 0 (fully transparent) to 1 (fully opaque).
6+
7+
Color values (fill or stroke aesthetics) may contain opacity information embedded, e.g. by using hex values with an alpha channel. How such colors are merged with the opacity aesthetic is writer-dependent and can't be relied on. Even if the behavior was consistent, mixing the two is never a good idea because it leads to hard-to-decode graphics.
8+
9+
## Literal values
10+
Opacity has no unit and goes from 0 (fully transparent) to 1 (fully opaque). You can set the opacity of points to a low value to combat overplotting like so:
11+
12+
```ggsql
13+
DRAW point
14+
SETTING opacity => 0.2
15+
```
16+
17+
## Palettes
18+
Opacity can only be used for sequential data and has no named palettes. The default for continuous, binned, and ordinal scales is to use the range from 0.1 to 1 and interpolate between them. This can be overwritten by providing a manual output range specification like below where we use the complete range opacity
19+
Lines changed: 27 additions & 0 deletions
Loading
Lines changed: 27 additions & 0 deletions
Loading
Lines changed: 27 additions & 0 deletions
Loading
Lines changed: 27 additions & 0 deletions
Loading
Lines changed: 27 additions & 0 deletions
Loading
Lines changed: 27 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)