Skip to content

Legend options unclear in documentation #825

Closed
@stevage

Description

@stevage

I'm coming to Observable Plot for the first time, without experience of Observable.

It's quite confusing trying to understand how to configure a legend.

plot.legend(name, options)

This would be clearer if the parameter was called "scale" not "name"

mylegend = myplot.legend("color")

This would be clearer if options were being passed in, because the whole rest of the section is about the options, but they're missing from the one actual example.

For an inline legend, use the scale.legend option:

It's very unclear how one "uses the scale.legend option". An example line of code would help a lot.

In the documentation under "Legends" we see:

mylegend = myplot.legend("color")

But this value "color" is not explained anywhere.

There is a list of options (options.tickFormat, options.swatchSize...) but it is incomplete. Other options (eg, options.legend) are referred to only in the paragraph text, which makes this section very difficult to skim.

At the bottom of the section, this example is given:

Plot.legend({color: {type: "linear"}})

But "color" is not documented anywhere.

I think maaaybe in the reference to scale.legend above, "scale" is actually a meta-variable for which color might be the actual value? This is really unclear and takes a lot of effort to work out.

Also, in this notebook, there is reference to a style property that doesn't seem to be documented here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to docs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions