You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Arguably, a very common use-case of geom_segment() is where either x == xendory == yend (not both though). This is the case for e.g. needle plots, lollipop charts, dumbbell plots, and probably some other plot types that I'm overlooking at the moment.
Currently, xend and yend are required aesthetics. I'm arguing that these should become optional aesthetics, where they internally default to x and y. To be explicit, I'm proposing that the GeomSegment$draw_panel method should start as follows:
If neither xend nor yend are specified, you get 0-length line segments that don't make any sense. This might be confusing to newcomers.
I haven't fully pondered the impact on extensions yet. From a brief glance, a non-trivial amount of GeomSegment extensions set either xend <- x or yend <- y, so this might save a line of code there as well. I expect that not many will break, but there might be unique situations.
Some upsides:
It will often save you the hassle of specifying one of the two end aesthetics.
This will not be a change that breaks existing plots. Previously, these parameters were required, so all pre-existing plots will already have xend/yend aesthetics.
Alternativly, we might also consider to make the required aesthetics c("x", "y", "xend|yend"). That'll throw an informative error in the first drawback case I mentioned.
The text was updated successfully, but these errors were encountered:
Arguably, a very common use-case of
geom_segment()
is where eitherx == xend
ory == yend
(not both though). This is the case for e.g. needle plots, lollipop charts, dumbbell plots, and probably some other plot types that I'm overlooking at the moment.Currently,
xend
andyend
are required aesthetics. I'm arguing that these should become optional aesthetics, where they internally default tox
andy
. To be explicit, I'm proposing that theGeomSegment$draw_panel
method should start as follows:I have thought of these drawbacks:
xend
noryend
are specified, you get 0-length line segments that don't make any sense. This might be confusing to newcomers.xend <- x
oryend <- y
, so this might save a line of code there as well. I expect that not many will break, but there might be unique situations.Some upsides:
xend
/yend
aesthetics.Alternativly, we might also consider to make the required aesthetics
c("x", "y", "xend|yend")
. That'll throw an informative error in the first drawback case I mentioned.The text was updated successfully, but these errors were encountered: