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
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -223,7 +223,7 @@ console.log(color.range); // inspect the color scale’s range, ["red", "blue"]
223
223
224
224
#### Plot.**scale**(*options*)
225
225
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.
227
227
228
228
```js
229
229
constcolor=Plot.scale({color: {type:"linear"}});
@@ -542,9 +542,9 @@ Plot.plot({
542
542
})
543
543
```
544
544
545
-
#### *plot*.legend(*scaleName*, *options*)
545
+
#### *plot*.**legend**(*scaleName*, *options*)
546
546
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:
548
548
549
549
```js
550
550
myplot =Plot.plot(…)
@@ -559,7 +559,7 @@ Or, with additional *options*:
559
559
mylegend =myplot.legend("color", {width:320})
560
560
```
561
561
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.
563
563
564
564
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:
0 commit comments