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.
Fixes #393
This PR adds the keywords
xdodge
andydodge
tomapping
which, like other hardcoded mappings (layout
,row
,col
,group
) are not tied to any Makie attributes in particular. Instead, these modify anyAesX
orAesY
columns, respectively, when they are used. This allows generic dodging of things like scatters or errorbars:The width of the dodging can be controlled with a scale attribute:
Caveats / remaining design problems
The most common scenario is errorbars on barplots, I think. However, barplots implement their own dodging via the
dodge
keyword. (There are a couple recipes that havedodge
implemented, rainclouds, crossbars, violins...) And the width does not depend on the dodging scale but on the plot's ownwidth
setting as well asgap
anddodge_gap
. So one can have mismatched dodging:One could use
xdodge
for barplot as well, but then this can conflict with thewidth
setting from barplot, which would then not be adjusted for anymore (barplot wouldn't know that dodging is going on)Note that in this particular case, if
width = 1
wasn't set, the plot would look ok, but that might not always be the case if enough categories are missing, so it's too brittle I think.So ideally, I think the
width
for widthless plots (scatter, errorbars, etc.) could be inferred from plots with width that are also using the dodge scale. So if a barplot is in the mix, the width would be picked up from it somehow. This adds a small layer of complexity on top of the processing pipeline but might be manageable.