Skip to content

Commit e6923f1

Browse files
committed
Update README
1 parent f7a0dfe commit e6923f1

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

README.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ Plot.plot({
211211
})
212212
```
213213

214-
#### *plot*.**scale**(*scaleName*)
214+
#### *plot*.scale(*scaleName*)
215215

216216
Scale definitions can be exposed through the *plot*.**scale**(*scaleName*) function of a returned plot. The *scaleName* must be one of the known scale names: `"x"`, `"y"`, `"fx"`, `"fy"`, `"r"`, `"color"`, `"opacity"`, `"symbol"`, or `"length"`.
217217

@@ -223,9 +223,9 @@ console.log(color.range); // inspect the color scale’s range, ["red", "blue"]
223223

224224
If the associated *plot* has no scale with the given *scaleName*, returns undefined.
225225

226-
#### Plot.**scale**(*options*)
226+
#### Plot.scale(*options*)
227227

228-
You can also create a standalone scale with Plot.**scale**(*options*). The *options* object must define at least one scale; see [Scale options](#scale-options) for how to define a scale.
228+
You can also create a standalone scale with Plot.**scale**(*options*). The *options* object must define at least one scale; see [Scale options](#scale-options) for how to define a scale. For example, here is a linear color scale with the default domain of [0, 1] and default scheme *turbo*:
229229

230230
```js
231231
const color = Plot.scale({color: {type: "linear"}});
@@ -544,7 +544,7 @@ Plot.plot({
544544
})
545545
```
546546

547-
#### *plot*.**legend**(*scaleName*, *options*)
547+
#### *plot*.legend(*scaleName*, *options*)
548548

549549
Given an existing *plot* returned by [Plot.plot](#plotplotoptions), returns a detached legend for the *plot*’s scale with the given *scaleName*. The *scaleName* must refer to a scale that supports legends: either `"color"`, `"opacity"`, or `"symbol"`. For example:
550550

@@ -603,14 +603,10 @@ The **style** legend option allows custom styles to override Plot’s defaults;
603603

604604
#### Plot.legend(*options*)
605605

606-
Returns a standalone legend for the scale defined by the given *options* object. The *options* object must define at least one scale; see [Scale options](#scale-options) for how to define a scale. For example, here is a ramp legend of the default linear color scale, with the default domain of [0, 1] and default scheme *turbo*:
606+
Returns a standalone legend for the scale defined by the given *options* object. The *options* object must define at least one scale; see [Scale options](#scale-options) for how to define a scale. For example, here is a ramp legend of a linear color scale with the default domain of [0, 1] and default scheme *turbo*:
607607

608608
```js
609-
Plot.legend({
610-
color: {
611-
type: "linear"
612-
}
613-
})
609+
Plot.legend({color: {type: "linear"}})
614610
```
615611

616612
The *options* object may also include any additional legend options described in the previous section. For example, to make the above legend slightly wider:

0 commit comments

Comments
 (0)