vega-lite icon indicating copy to clipboard operation
vega-lite copied to clipboard

Permit multiple fields for row and columns channels

Open marcprux opened this issue 4 years ago • 5 comments

Being able to arbitrarily facet on multiple fields is very useful in data exploration. It is currently possible to facet on at most 2 fields (one in row and one in column) using the faceting shorthand encoding channels, even through it is possible to nest hconcat and vconcat layers arbitrarily deep.

It would be useful if the row and column channels could accept more than one field in order to generate deep layer nests. Among other uses, this could enable simple hierarchical groupings of separate related categorical fields. E.g.:

{
  "data": {"url": "data/birdstrikes.json"},
  "mark": {"type": "line"},
  "encoding": {
    "row": [
      {"field": "Wildlife__Size", "type": "nominal"},
      {"field": "Wildlife__Species", "type": "nominal"}
    ],
    "x": {"field": "Flight_Date", "type": "temporal", "timeUnit": "year"},
    "y": {"field": "Cost__Other", "aggregate": "sum", "type": "quantitative"}
  }
}

It seems like the resulting layer transformations could easily be applied recursively for each additional facet encoding.

marcprux avatar Feb 13 '20 01:02 marcprux

Vega-Lite already supports facets of facets using the facet operator. I read this as a feature request to support arrays in the shorthand notion and translate to a nested faceted spec (and make sure the nesting actually works). Does that make sense?

domoritz avatar Feb 13 '20 04:02 domoritz

Precisely.

marcprux avatar Feb 13 '20 04:02 marcprux

Vega-Lite already supports facets of facets using the facet operator

We actually do NOT have an official support for it in the JSON schema yet, since it doesn't always behave correctly. See https://github.com/vega/vega-lite/issues/2775.

Thus, we shouldn't implement this until nested facet always works correctly.

kanitw avatar Feb 13 '20 05:02 kanitw

Sorry, I should have been more clear. Vega-Lite conceptually supports nesting facets. The implementation has some bugs so we don't support it yet.

domoritz avatar Feb 13 '20 18:02 domoritz

Hi. This issue has not been closed. I would like to know how the issue is progressing. Thank you.

bigfacewo avatar Jun 15 '22 07:06 bigfacewo