Skip to content

Commit 4500e0e

Browse files
committed
Update README
1 parent 15e7b81 commit 4500e0e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -489,15 +489,15 @@ When the *include* or *exclude* facet mode is chosen, the mark data must be para
489489

490490
## Legends
491491

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:
493493

494-
* *scale*.**legend** - if truthy, generate a legend for the specified scale
494+
* *scale*.**legend** - if truthy, generate a legend for the given scale
495495

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.
497497

498498
### *plot*.legend(*name*, *options*)
499499

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:
501501

502502
```js
503503
myplot = Plot.plot(…)
@@ -506,8 +506,6 @@ myplot = Plot.plot(…)
506506
mylegend = myplot.legend("color")
507507
```
508508

509-
Currently only *color* and *opacity* scales are supported. An opacity scale is treated as a color scale with varying transparency.
510-
511509
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:
512510

513511
* *options*.**tickFormat** - a format function for the labels

0 commit comments

Comments
 (0)