Skip to content

Commit 47fb222

Browse files
committed
Update README
1 parent 95fc173 commit 47fb222

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ console.log(color.range); // inspect the color scale’s range, ["red", "blue"]
223223

224224
#### Plot.**scale**(*options*)
225225

226-
You can also create a standalone scale with Plot.**scale**(*options*):
226+
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.
227227

228228
```js
229229
const color = Plot.scale({color: {type: "linear"}});
@@ -542,9 +542,9 @@ Plot.plot({
542542
})
543543
```
544544

545-
#### *plot*.legend(*scaleName*, *options*)
545+
#### *plot*.**legend**(*scaleName*, *options*)
546546

547-
Given an existing *plot* returned by [Plot.plot](#plotplotoptions), returns a detached legend for the *plot*’s scale with the given *scaleName*. For example:
547+
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:
548548

549549
```js
550550
myplot = Plot.plot(…)
@@ -559,7 +559,7 @@ Or, with additional *options*:
559559
mylegend = myplot.legend("color", {width: 320})
560560
```
561561

562-
The *scaleName* must refer to a scale that supports legends: either `"color"`, `"opacity"`, or `"symbol"`. If there is no corresponding scale on the given *plot*, then *plot*.legend will return undefined.
562+
If there is no scale with the given *scaleName* on the given *plot*, then *plot*.legend will return undefined.
563563

564564
Categorical and ordinal color legends are rendered as swatches, unless *options*.**legend** is set to *ramp*. The swatches can be configured with the following options:
565565

0 commit comments

Comments
 (0)