observablehq / observablehq/plot

Auto mark: add more override-only mark types?

Open
#1,422 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
HTML
Stars
5.4k
Forks
244
PR merge metrics
No merged PRs in 30d

Description

So far, the only mark types that Plot.auto supports are those that it might pick automatically — except area, which is a lot like a line with zero: true, but you can only get it by explicitly setting the mark type. We could add more marks like that. E.g. box plots and voronois would be easy.

In these cases, you're not getting much automatic inference out of Plot.auto, except the different reduce syntax; you should almost certainly be using the explicit mark. But if we want mark types to be available in the chart cell, we'd have to add them to Plot.auto. But most of these override-only marks would take us farther outside the fuzzy intersection we've aimed for, where most channels (except size) apply to all the marks you could choose, and most configs lead to some chart.

The other issue is that many of these are most valuable in combination with another mark, in which case maybe we should think about them more like we think about the zero rule: as a "decoration" atop the main chosen mark.

  • Box plot: could only support fill or stroke; wouldn’t work on quant-quant scales. See also https://github.com/observablehq/plot/issues/1330
  • Voronoi: might be better as a decoration atop dot; unclear value if not for interaction
  • Vector: notionally the reason “size” isn’t called “radius”, but not very useful without a rotate channel passed through, which wouldn’t apply to any other mark
  • Hexbin: it’s a transformation, not a mark; benefits from having a background of Plot.hexgrid.
  • Density / contour: sorta rare; maybe a useful mark to infer if number of points is gigantic?
  • Linear regression: would have to have x and y version, because we can't infer independent/dependent variable; might be better as a decoration atop dot; could be specified more like y: {value: "height", regress: true}??
  • Text: probably the most important, but also the most suited for being a decoration, and would need a text channel too

Demo: https://observablehq.com/d/371da15a81cfa596
Sketch PR: https://github.com/observablehq/plot/pull/1423

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the Plot.auto behavior described here, the demo, and the sketch PR #1423; also review the related box-plot issue #1330. Done would require an agreed scope for which override-only marks or decorations should be supported and how they fit Plot.auto, but the issue does not establish that decision.

Written by the indexing model from the issue text.

Assessment

Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.