Skip to content

Commit 6cf51bf

Browse files
committed
scale edits
1 parent d4c477a commit 6cf51bf

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

docs/features/scales.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Plot.lineY(gistemp, {x: "Date", y: "Anomaly"}).plot()
4646
```
4747
:::
4848

49-
In Plot, a [mark’s channels](./marks.md) are bound to scales; for example, the line’s **x** channel is bound to the *x* scale. The channel name and the scale name are often the same, but not always; for example, an area’s **y1** and **y2** channels are both bound to the *y* scale. (You can opt-out of a scale for a particular channel using [scale overrides](./marks.html#mark-options) if needed.)
49+
In Plot, the [mark](./marks.md) binds channels to scales; for example, the line’s **x** channel is bound to the *x* scale. The channel name and the scale name are often the same, but not always; for example, an area’s **y1** and **y2** channels are both bound to the *y* scale. (You can opt-out of a scale for a particular channel using [scale overrides](./marks.html#mark-options) if needed.)
5050

5151
Think of a scale as a function that takes an abstract value and returns the corresponding visual value. For the *y* scale above, that might look like this:
5252

@@ -569,7 +569,7 @@ All position scales (*x*, *y*, *fx*, and *fy*) have implicit automatic ranges ba
569569
The **transform** scale option allows you to apply a function to all values before they are passed through the scale. This is convenient for transforming a scale’s data, say to convert to thousands or between temperature units.
570570

571571
:::plot defer
572-
```js
572+
```js{5}
573573
Plot.plot({
574574
y: {
575575
grid: true,
@@ -587,17 +587,12 @@ Plot.plot({
587587
The **percent** scale option is shorthand for a **transform** that multiplies values by 100; it also adds a percent symbol (%) to the default label.
588588

589589
:::plot
590-
```js
590+
```js{2}
591591
Plot.plot({
592-
y: {
593-
percent: true
594-
},
595-
color: {
596-
type: "diverging",
597-
scheme: "BuRd"
598-
},
592+
y: {percent: true}, // convert proportion [0, 1] to percent [0, 100]
593+
color: {scheme: "BuRd"},
599594
marks: [
600-
Plot.rectY(gistemp, Plot.binX({y: "proportion", fill: "median"}, {x: "Anomaly", fill: "Anomaly"})),
595+
Plot.rectY(gistemp, Plot.binX({y: "proportion", fill: "x"}, {x: "Anomaly", fill: "Anomaly"})),
601596
Plot.ruleY([0])
602597
]
603598
})

0 commit comments

Comments
 (0)