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
-**`FROM [...]`** - Input range specification (maps to Vega-Lite `scale.domain`)
1215
-
-**`TO [...]`** or **`TO palette`** - Output range as array or named palette (maps to Vega-Lite `scale.range` or `scale.scheme`)
1214
+
-**`FROM (...)`** - Input range specification (maps to Vega-Lite `scale.domain`). Square brackets `[...]` are also accepted.
1215
+
-**`TO (...)`** or **`TO palette`** - Output range as array or named palette (maps to Vega-Lite `scale.range` or `scale.scheme`). Square brackets `[...]` are also accepted.
1216
1216
-**`VIA transform`** - Transformation method (reserved for future use)
Copy file name to clipboardExpand all lines: doc/gallery/examples/minard.qmd
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -114,24 +114,24 @@ VISUALISE long AS x, lat AS y FROM 'minard_troops.csv'
114
114
DRAW path
115
115
MAPPING direction AS stroke, survivors AS linewidth
116
116
PARTITION BY direction, group
117
-
SCALE stroke TO ['burlywood', 'black']
117
+
SCALE stroke TO ('burlywood', 'black')
118
118
RENAMING 'A' => 'Advance', 'R' => 'Retreat'
119
119
```
120
120
121
121
Now for a slightly more complicated scale, we're going to set one for the `linewidth` variable that represent the number of troops.
122
122
If you want to build in some extra intuition for the scale, you can let 0 troops coincide with 0 linewidth.
123
-
We define the output range using `TO [0, 20]` because for a continuous variable it expects the output limits.
124
-
Slightly more elaborate is the input domain, where we use `FROM [0, null]` to state that the scale should start at 0 and go up to the largest value in the data.
123
+
We define the output range using `TO (0, 20)` because for a continuous variable it expects the output limits.
124
+
Slightly more elaborate is the input domain, where we use `FROM (0, null)` to state that the scale should start at 0 and go up to the largest value in the data.
125
125
Because both the input and output ranges start at 0, we get a well-proportioned line.
126
126
127
127
```{ggsql}
128
128
VISUALISE long AS x, lat AS y FROM 'minard_troops.csv'
129
129
DRAW path
130
130
MAPPING direction AS stroke, survivors AS linewidth
131
131
PARTITION BY direction, group
132
-
SCALE stroke TO ['burlywood', 'black']
132
+
SCALE stroke TO ('burlywood', 'black')
133
133
RENAMING 'A' => 'Advance', 'R' => 'Retreat'
134
-
SCALE linewidth FROM [0, null] TO [0, 20]
134
+
SCALE linewidth FROM (0, null) TO (0, 20)
135
135
```
136
136
137
137
## Polishing
@@ -153,9 +153,9 @@ VISUALISE long AS x, lat AS y FROM 'minard_troops.csv'
153
153
DRAW text
154
154
MAPPING city AS label FROM 'minard_cities.csv'
155
155
SETTING fontsize => 6
156
-
SCALE stroke TO ['burlywood', 'black']
156
+
SCALE stroke TO ('burlywood', 'black')
157
157
RENAMING 'A' => 'Advance', 'R' => 'Retreat'
158
-
SCALE linewidth FROM [0, null] TO [0, 30]
158
+
SCALE linewidth FROM (0, null) TO (0, 30)
159
159
```
160
160
161
161
An additional obvious way to polish your graphic is to add nicer titles for all your variables.
@@ -172,9 +172,9 @@ VISUALISE long AS x, lat AS y FROM 'minard_troops.csv'
172
172
DRAW text
173
173
MAPPING city AS label FROM 'minard_cities.csv'
174
174
SETTING fontsize => 6
175
-
SCALE stroke TO ['burlywood', 'black']
175
+
SCALE stroke TO ('burlywood', 'black')
176
176
RENAMING 'A' => 'Advance', 'R' => 'Retreat'
177
-
SCALE linewidth FROM [0, null] TO [0, 20]
177
+
SCALE linewidth FROM (0, null) TO (0, 20)
178
178
LABEL
179
179
title => 'Napoleon\'s Russian Campaign',
180
180
subtitle => 'Inspired by the graphic of C.J. Minard',
Copy file name to clipboardExpand all lines: doc/get_started/anatomy.qmd
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,7 @@ As [described above](#scales), ggsql automatically creates a default for mapped
64
64
The clause allows you to set the type of scale, the input range, the output range, the transformation, and lets you control breaks and label formatting. So, the clause can end up with a lot of information but the syntax has been designed so it reads very natural. Further, every part is optional and can be left out if the default fits. An example of a rather complex `SCALE` clause could be:
65
65
66
66
```ggsql
67
-
SCALE ORDINAL fill FROM ['Low', 'Mid', 'High'] TO viridis
67
+
SCALE ORDINAL fill FROM ('Low', 'Mid', 'High') TO viridis
Copy file name to clipboardExpand all lines: doc/get_started/the_rest.qmd
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,7 @@ DRAW bar
99
99
PROJECT TO polar
100
100
FACET island
101
101
SETTING free => 'angle'
102
-
SCALE panel FROM ['Biscoe', 'Dream']
102
+
SCALE panel FROM ('Biscoe', 'Dream')
103
103
```
104
104
105
105
Above, we use the `free` parameter of facet to allow each facet to have their own angle scale. Further, we use `SCALE` on the panel aesthetic to only show panels for the Biscoe and Dream islands.
@@ -112,7 +112,7 @@ DRAW bar
112
112
PROJECT TO polar
113
113
FACET island
114
114
SETTING free => 'angle'
115
-
SCALE panel FROM ['Biscoe', 'Dream']
115
+
SCALE panel FROM ('Biscoe', 'Dream')
116
116
LABEL
117
117
title => 'Distribution of penguin species between islands',
0 commit comments