-
Notifications
You must be signed in to change notification settings - Fork 185
Revisit facets #1041
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
Closed
Closed
Revisit facets #1041
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
955708a
to
bf8fb3f
Compare
… a multiplication table example
0537768
to
84c2696
Compare
To consider:
|
|
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
demo for this PR: https://observablehq.com/@observablehq/plot-facet-annotations-1041
The changes listed below address the following issues:
Facets are currently exclusive
A single datum can’t currently appear in two different facets.
This results in:
Change 1: fix the bug by expanding channels as necessary (commit b3cdc4a)This part is now superseded byfacetReindex #1057make facet indexes rectangular if they overlap #1068, Facet expand #1069 or add a definition to the {transform} representation of a value #1070.Change 2: introduce facet filters (commit bf8fb3f)
✓ confirmed that bf8fb3f can be cherry-picked on top of #1068
✓ superseded by #1089
Facets are currently defined globally
Marks can opt in or out of faceting, but currently they have to be aligned on the same facet index (or its complement if using the “exclude” filter). If we allowed to define facets on each mark, we could have two different data with different shapes correctly and logically connected to the facets.
This seems important for time channels but also for trivial things like “adding a specific text on a specific facet”, which is currently too difficult (one has to define channels of the same lengths as the original facet data, and use Plot.selectFirst on them).
(commit 0c2fadf)extracted to PR mark-level facets #1085.Note: it makes particular sense to define facet filters on a mark (as in change 2), rather than globally, but we could decide to have both.
Facets are currently limited to x and y
Plan is to extend them to (at least) a time facet.
Open questions
API Design
In parallel we need to think about the API design. I’ll start with something and it should be pretty easy to change. Backward compatibility is a hard requirement.
Here are various possibilities:
Plot.dot(data, {facet: {y: “year”, yFilter: “lte”}})
, but now that I've been using this a bit, I want the API to be flat, like so:The remainder of this process, for time facets and animations, will belong to a new pull request
Variable scales
How do we design a scale that varies with a facet (its domain being driven by the extent of channels in this facet)?
Time facets
Change 5: implement time facet / animation (some draft code in PR #1018).
Change 6: implement (partial) web animations API (some draft code in this notebook).
The time facet is a bit different from x and y, because its output might be an animation inside a rather than a row or column of elements. Also, it makes a natural use of facet filtering such as “lte”, for example to display a connected scatterplot.