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-6Lines changed: 4 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -489,15 +489,15 @@ When the *include* or *exclude* facet mode is chosen, the mark data must be para
489
489
490
490
## Legends
491
491
492
-
Plot can generate legends for *color* and *opacity*[scales](#scale-options). For an inline legend, use the *scale*.**legend** option:
492
+
Plot can generate legends for *color* and *opacity*[scales](#scale-options). (An opacity scale is treated as a color scale with varying transparency.) For an inline legend, use the *scale*.**legend** option:
493
493
494
-
**scale*.**legend** - if truthy, generate a legend for the specified scale
494
+
**scale*.**legend** - if truthy, generate a legend for the given scale
495
495
496
-
If the *scale*.**legend** option is true, the default legend will be produced for the scale; otherwise, the meaning of the *legend* option depends on the scale type. For quantitative color scales, it defaults to *ramp* but may be set to *swatches* for a discrete scale (most commonly for *threshold* color scales); for ordinal color scales, only the *swatches* value is supported.
496
+
If the *scale*.**legend** option is true, the default legend will be produced for the scale; otherwise, the meaning of the *legend* option depends on the scale. For quantitative color scales, it defaults to *ramp* but may be set to *swatches* for a discrete scale (most commonly for *threshold* color scales); for ordinal color scales, only the *swatches* value is supported.
497
497
498
498
### *plot*.legend(*name*, *options*)
499
499
500
-
Given an existing *plot* returned by [Plot.plot](#plotplotoptions), returns a suitable legend for the *plot*’s scale with the given *name*. For example:
500
+
Given an existing *plot* returned by [Plot.plot](#plotplotoptions), returns a legend for the *plot*’s scale with the given *name*. For example:
501
501
502
502
```js
503
503
myplot =Plot.plot(…)
@@ -506,8 +506,6 @@ myplot = Plot.plot(…)
506
506
mylegend =myplot.legend("color")
507
507
```
508
508
509
-
Currently only *color* and *opacity* scales are supported. An opacity scale is treated as a color scale with varying transparency.
510
-
511
509
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:
512
510
513
511
**options*.**tickFormat** - a format function for the labels
0 commit comments