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
+6-10Lines changed: 6 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -211,7 +211,7 @@ Plot.plot({
211
211
})
212
212
```
213
213
214
-
#### *plot*.**scale**(*scaleName*)
214
+
#### *plot*.scale(*scaleName*)
215
215
216
216
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"`.
217
217
@@ -223,9 +223,9 @@ console.log(color.range); // inspect the color scale’s range, ["red", "blue"]
223
223
224
224
If the associated *plot* has no scale with the given *scaleName*, returns undefined.
225
225
226
-
#### Plot.**scale**(*options*)
226
+
#### Plot.scale(*options*)
227
227
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*:
229
229
230
230
```js
231
231
constcolor=Plot.scale({color: {type:"linear"}});
@@ -544,7 +544,7 @@ Plot.plot({
544
544
})
545
545
```
546
546
547
-
#### *plot*.**legend**(*scaleName*, *options*)
547
+
#### *plot*.legend(*scaleName*, *options*)
548
548
549
549
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:
550
550
@@ -603,14 +603,10 @@ The **style** legend option allows custom styles to override Plot’s defaults;
603
603
604
604
#### Plot.legend(*options*)
605
605
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*:
607
607
608
608
```js
609
-
Plot.legend({
610
-
color: {
611
-
type:"linear"
612
-
}
613
-
})
609
+
Plot.legend({color: {type:"linear"}})
614
610
```
615
611
616
612
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