Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly Cross Nested Facet #2775

Open
2 tasks
kanitw opened this issue Aug 4, 2017 · 3 comments
Open
2 tasks

Correctly Cross Nested Facet #2775

kanitw opened this issue Aug 4, 2017 · 3 comments
Labels
Area - View Composition P3 Should be fixed at some point

Comments

@kanitw
Copy link
Member

kanitw commented Aug 4, 2017

Just like how we have scale resolution.

When Facet is nested, we need to resolve domain of inner facet and impute additional facet cells accordingly.

For example, given a spec:

{
  "$schema": "https://vega.github.io/schema/vega-lite/v2.json",
  "data": {"url": "data/cars.json"},
  "facet": {"column": {"field": "Origin","type": "nominal"}},
  "spec": {
    "facet": {
      "column": {"field": "Cylinders","type": "ordinal"},
      "row": {"bin": {"maxbins": 4}, "field": "Displacement","type": "quantitative"}
    },
    "spec": {
      "mark": "point",
      "encoding": {
        "x": {"field": "Horsepower","type": "quantitative"},
        "y": {"field": "Acceleration","type": "quantitative"}
      }
    }
  }
}

by default we would expect the table to be

( Origin \ Cylinder ) x Bin(Displacement)

which means Bin(Displacement) is crossed against Origin.

However, what we currently generate is Origin \ (Cylinder x Bin(Displacement))
so Bin(Displacement) is nested under Origin.

Thus, the output nested facet "table" is imbalanced:

vega_editor

We need a few things to make this correct

  • a mechanism for resolving facet domain so that we correctly produce data sources for facet domain (for headers)
  • a mechanism for imputing Vega's facet operator to fill the domain. (This may require multi-dimensional imputation if we have two layers of facets with both row and column.)
@kanitw kanitw changed the title Need Facet Domain Resolution Problems with Nested Facet With Crossing Aug 4, 2017
@kanitw kanitw changed the title Problems with Nested Facet With Crossing Correctly Cross Nested Facet Aug 4, 2017
@jheer
Copy link
Member

jheer commented Aug 4, 2017

Regarding "a mechanism for imputing Vega's facet operator to fill the domain": is it sufficient to use the cross option, which you can specify under facet.aggregate? This will impute missing cells.

Or, do you want to distribute this across multiple facet operations, and be able to provide a set of domain values to parameterize the imputation?

@kanitw
Copy link
Member Author

kanitw commented Aug 5, 2017

This is a simpler example: https://pastebin.com/AaC9DFUH
(I still set columns: 3 as a hack as I can't get vega-editor to correctly get the latest Vega-View yet.)

{
  "$schema": "https://vega.github.io/schema/vega-lite/v2.json",
  "data": {"url": "data/cars.json"},
  "facet": {"column": {"field": "Origin","type": "nominal"}},
  "spec": {
    "facet": {
      "column": {"field": "Cylinders","type": "ordinal"},
      "row": {"bin": {"maxbins": 4}, "field": "Displacement","type": "quantitative"}
    },
    "spec": {
      "mark": "point",
      "encoding": {
      }
    }
  }
}

vega_editor

In this figure , inside the Europe and Japan cell, although we already turn cross: true for them, they do not know that there should be 4 bins for bin_displacement.

If we have data sources wiring up correctly, we would have a child_row_domain data source that have 4 bins for bin_displacement and ideally we should be able to wire up this row_domain data source to the facet's "impute" directive to impute bin_displacement with all domain values aggregating+crossing.

(I think this is a bit hairy so I prefer that we do not support this in VL 2.0 -- but I wanna note down so we can come back to it in the future.)

A related question is whether we wanna allow facet of facet at all.
(Nested Facet without crossing is working fine but nested facet with crossing is not as described above.)

@kanitw kanitw modified the milestone: 2.1? Important Patches Aug 5, 2017
@kanitw kanitw modified the milestones: 2.x? Important Patches, 2.x Composition Patches Sep 22, 2017
@kanitw kanitw added the P4 Nice to Have label Jun 9, 2019
@kanitw kanitw modified the milestones: x.x View Composition, x.x Dec 4, 2019
@kanitw kanitw added P3 Should be fixed at some point and removed P4 Nice to Have labels Feb 13, 2020
@kanitw kanitw removed this from the x.x milestone May 16, 2020
@bigfacewo
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area - View Composition P3 Should be fixed at some point
Projects
None yet
Development

No branches or pull requests

3 participants