Skip to content

Commit bfd2254

Browse files
committed
Update README
1 parent d000ebd commit bfd2254

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,16 @@ Currently only *color* and *opacity* scales are supported. If the *scale*.**lege
237237

238238
#### *plot*.legend(*name*, *options*)
239239

240-
Returns a suitable legend for the given *plot*’s scale with the given *name*. Currently only *color* and *opacity* scales are supported. An opacity scale is treated as a color scale with varying transparency.
240+
Given an existing *plot* returned by [Plot.plot](#plotplotoptions), returns a suitable legend for the *plot*’s scale with the given *name*. For example:
241+
242+
```js
243+
myplot = Plot.plot(…)
244+
```
245+
```js
246+
mylegend = myplot.legend("color")
247+
```
248+
249+
Currently only *color* and *opacity* scales are supported. An opacity scale is treated as a color scale with varying transparency.
241250

242251
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:
243252

0 commit comments

Comments
 (0)