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.
This PR closes #4732 by providing orientation-aware key glyphs for
geom_boxplot()
,geom_crossbar()
,geom_pointrange()
, andgeom_linerange()
.For example, before these changes:
Created on 2022-03-15 by the reprex package (v2.0.1)
After these changes:
Specifically, this PR:
draw_key_boxplot()
,draw_key_crossbar()
, anddraw_key_pointrange()
to be orientation-awaredraw_key_linerange()
, which is an orientation-aware version ofdraw_key_path()
(becausedraw_key_path()
is used by other geoms whose legends should not be orientation-aware, I could not simply makedraw_key_path()
orientation aware).geom_linerange()
to bedraw_key_linerange()
instead ofdraw_key_path()
.and verticallegends.This might be too many graphical tests; I'm happy to reduce them --- perhaps by removing the vertical tests (the old behavior) and just leaving the horizontal ones.I have condensed the visual tests down to just two for horizontal legends; I'm not sure there's a clear way to reduce them to fewer.This PR does not add orientation-aware key glyphs to
geom_errorbar()
orgeom_errobarh()
, as these geoms consist of both horizontal and vertical lines, so it seemed reasonable to leave them as is. In fact,geom_errorbarh()
already has the same key glyph asgeom_errorbar()
rather than one of the opposite orientation, corroborating my sense that the legends for these two geoms do not need to be orientation-aware.