Skip to content

Add bidirectionality to layers#176

Draft
thomasp85 wants to merge 2 commits intoposit-dev:mainfrom
thomasp85:issue111-orientation
Draft

Add bidirectionality to layers#176
thomasp85 wants to merge 2 commits intoposit-dev:mainfrom
thomasp85:issue111-orientation

Conversation

@thomasp85
Copy link
Collaborator

Fix #111

This PR adds unified support for bidirectionality to layers using the same ideas as we did in ggplot2. However, we can be a bit less guessing about it here because we have access to the actual scales.

It also sets in stone what a layers primary axis must be to work with this:

  1. If the layer only need one positional aesthetic (because the second is calculated) then that aesthetic must be the primary one (e.g. histogram)
  2. If the layer has a discrete axis and a continuous one then the discrete is the primary (e.g. box plot)
  3. If a layer has two continuous axes and one of them takes a range mapping (e.g. ymin/ymax) then the range axis is the secondary one (e.g. ribbon)
  4. If a layer accepts no positional mappings then the remapping goes to the secondary axis (e.g. bar)

Any new layer with orientation should follow these rules

Only area and line currently needs orientation explicitly set for flipping - the rest can be deduced with certainty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle layer orientation

1 participant