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
+10-1Lines changed: 10 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -237,7 +237,16 @@ Currently only *color* and *opacity* scales are supported. If the *scale*.**lege
237
237
238
238
#### *plot*.legend(*name*, *options*)
239
239
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.
241
250
242
251
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