Skip to content

Commit 0453cdc

Browse files
committed
edits
1 parent 2fd9685 commit 0453cdc

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

docs/features/scales.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ onMounted(() => {
2727

2828
# Scales
2929

30-
**Scales** convert an abstract value such as time or temperature to a visual value such as *x*- or *y*-position or color. For example, say we have a tabular dataset (`gistemp`) containing monthly observations of [global average surface temperature](https://data.giss.nasa.gov/gistemp/) from 1880 to 2016. The first few rows are:
30+
**Scales** convert an abstract value such as time or temperature to a visual value such as *x* or *y*position or color. For example, say we have a dataset (`gistemp`) containing monthly observations of [global average surface temperature](https://data.giss.nasa.gov/gistemp/) from 1880 to 2016. The first few rows are:
3131

3232
| Date | Anomaly |
3333
|------------|--------:|
@@ -46,7 +46,7 @@ Plot.lineY(gistemp, {x: "Date", y: "Anomaly"}).plot()
4646
```
4747
:::
4848

49-
In Plot, [mark 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, 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.)
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

@@ -63,8 +63,7 @@ The function `y` depends on a few additional details: the chart’s size and mar
6363
const marginTop = 20;
6464
const marginBottom = 30;
6565
const height = 400;
66-
const minAnomaly = d3.min(gistemp, (d) => d.Anomaly);
67-
const maxAnomaly = d3.max(gistemp, (d) => d.Anomaly);
66+
const [minAnomaly, maxAnomaly] = d3.extent(gistemp, (d) => d.Anomaly);
6867
```
6968

7069
Scales aren’t limited to horizontal and vertical position. They can also output to color, radius, length, opacity, and more. For example if we switch to a [rule](../marks/rule.md) and use the **stroke** channel instead of **y**, we get a one-dimensional heatmap:
@@ -84,7 +83,7 @@ function color(anomaly) {
8483
}
8584
```
8685

87-
Within a given plot, marks share scales. For example, if a plot has two line marks, both share the same *x* and *y* scales for a consistent encoding.
86+
Within a given [plot](./plots.md), marks share scales. For example, if a plot has two line marks, both share the same *x* and *y* scales for a consistent encoding.
8887

8988
:::plot defer
9089
```js
@@ -190,7 +189,7 @@ Plot.plot({x: {type: "log", domain: [1e0, 1e5], tickFormat: ",", grid: true}})
190189
```
191190
:::
192191

193-
Log scales also support a **base** option, say for powers of two. This does not affect the scale’s encoding, but it does change which ticks are shown.
192+
Log scales also support a **base** option, say for powers of two. This does not affect the scale’s encoding, but it does change where ticks are shown.
194193

195194
:::plot
196195
```js
@@ -234,7 +233,7 @@ Plot.plot({x: {type: "point", domain: "ABCDEFGHIJ", grid: true}})
234233
```
235234
:::
236235

237-
A band scale divides space into uniformly-spaced and -sized discrete intervals. It is commonly used for bar charts (bar marks). (To show the bands, below we use a [cell](../marks/cell.md) instead of a [grid](../marks/grid.md).)
236+
A band scale divides space into uniformly-spaced and -sized discrete intervals. It is commonly used for bar charts (bar marks). To show the bands below, we use a [cell](../marks/cell.md) instead of a [grid](../marks/grid.md).
238237

239238
:::plot
240239
```js
@@ -525,11 +524,13 @@ Plot.plot({
525524
```
526525
:::
527526

528-
Unlike continuous color schemes for quantitative data, these discrete color schemes are optimized for low-cardinality domains. If the size of the categorical domain exceeds the number of colors in the scheme, colors will be reused; combining values into an “other” category is recommended.
527+
:::warning CAUTION
528+
Discrete color schemes are intended for data that has only a few unique values. If the size of the categorical domain exceeds the number of colors in the scheme, colors will be reused; combining values into an “other” category is recommended.
529+
:::
529530

530531
## Other scales
531532

532-
But wait, there’s more! Plot has *opacity*, *r*, *symbol*, and *length* scales, too. For example, the *r* scale **type** defaults to *sqrt* such that when used with the [dot mark](../marks/dot.md), the resulting area is proportional to the **r** channel value. You can adjust the effective dot size by specifying an explicit **range**, as below.
533+
But wait, there’s more! 😅 Plot has *opacity*, *r*, *symbol*, and *length* scales, too. For example, the *r* scale **type** defaults to *sqrt* such that when used with the [dot mark](../marks/dot.md), the resulting area is proportional to the **r** channel value. You can adjust the effective dot size by specifying an explicit **range**, as below.
533534

534535
<p>
535536
<label class="label-input">

docs/transforms/hexbin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ Plot.plot({
119119
:::
120120

121121
:::warning CAUTION
122-
Beware the [modifiable areal unit problem](https://en.wikipedia.org/wiki/Modifiable_areal_unit_problem). On a small scale map, this is compounded by the Earth’s curvature, which makes it impossible to create an accurate and regular grid. Use an equal-area projection in conjunction when binning.
122+
Beware the [modifiable areal unit problem](https://en.wikipedia.org/wiki/Modifiable_areal_unit_problem). On a small scale map, this is compounded by the Earth’s curvature, which makes it impossible to create an accurate and regular grid. Use an equal-area projection when binning.
123123
:::
124124

125125
The [hexgrid mark](../marks/hexgrid.md) draws the base hexagonal grid as a mesh. This is useful for showing the empty hexagons, since the hexbin transform does not output empty bins (and unlike the bin transform, the hexbin transform does not currently support the **filter** option).

0 commit comments

Comments
 (0)