Open stevage opened 2 years ago
Swatches legends do not currently support a label option, but it’s noted as a TODO here:
there's even a pull-request https://github.com/observablehq/plot/pull/621
This came up today in discussing how the chart cell height jumps when you switch between an ordinal and continuous color scale. Fil pointed out that continuous also gets a label and ordinal doesn't, which contributes to the height difference.
(Separately, it'd be nice if one row of swatches matched the height of the continuous legend. Though I know it's tricky, since continuous demands value labels below, whereas ordinal can have value labels between. I guess it's in the nature of continuity that it leaves no room for inline labels!)
I'd like to +1 / bump this issue. I was surprised to be unable to add a title to categorical legends!
Also chiming in to 👍 this issue (now closed by #1885).
I have three kinds of plots, all using binX:
myplot.legend('color', ...)
Plot.legend({ color: ...
myplot.legend('color', ... )
In the first two cases, a scale legend is shown, defaulting to the name of the channel (right terminology?) containing the values being color-coded.
In the third case, a scale legend is not shown, and passing
label:
has no effect.This is my code: