Skip to content

Facet sort order not applied in presence of an aggregate #5366

Description

@jakevdp

The facet sort order works as expected with non-aggregated data (editor):

{
  "data": {"url": "data/cars.json"},
  "mark": "bar",
  "encoding": {
    "row": {
      "type": "nominal",
      "field": "Origin",
      "sort": ["Japan", "Europe", "USA"]
    },
    "x": {"type": "quantitative", "field": "Horsepower"}
  }
}

visualization - 2019-09-03T064930 520

But if an aggregation is added to the x-axis, the order is no longer respected (editor):

{
  "data": {"url": "data/cars.json"},
  "mark": "bar",
  "encoding": {
    "row": {
      "type": "nominal",
      "field": "Origin",
      "sort": ["Japan", "Europe", "USA"]
    },
    "x": {"type": "quantitative", "field": "Horsepower", "aggregate": "mean"}
  }
}

visualization - 2019-09-03T065029 595

Reported in vega/altair#1683

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions