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
For some time, we've supported a type-level x/ylevels argument for several types (e.g., type_barplot and type_spineplot). To wit, this takes "a character or numeric vector specifying the ordering of the levels of the x variable (if character) or the corresponding indexes (if numeric) for the plot."
However, during the current v0.8.0 development cycle, I also added type-level xlevels support to type_lines() and type_points(), as a way to fix some layering/alignment inconsistencies between the two (#683). I did this by overloading the argument, so that it also accepted keywords strings (like "asis") and functions.
I originally thought that repurposing (extending) an existing argument was an elegant solution. On reflection, however, I've come to realise that this overloading of x/ylevels is a bad idea. Not only is it brittle, but it isn't very intuitive. I now think we should:
revert x/ylevels as originally scoped: i.e., a literal ordering of a variable levels.
introduce companion x/yord arguments that derive the order of variables via keywords like "asis" and functions, which apply the appropriate operation on the data. Note that we already have precedent with byord for stacked area plots (Stacked area #688).
These two functions should be mutually exclusive; privilege (the literal) x/ylevels over (the derived) x/yord if both are provided.
Subititle: Rather use dedicated
x/yordarguments.For some time, we've supported a type-level
x/ylevelsargument for several types (e.g.,type_barplotandtype_spineplot). To wit, this takes "a character or numeric vector specifying the ordering of the levels of the x variable (if character) or the corresponding indexes (if numeric) for the plot."However, during the current v0.8.0 development cycle, I also added type-level
xlevelssupport totype_lines()andtype_points(), as a way to fix some layering/alignment inconsistencies between the two (#683). I did this by overloading the argument, so that it also accepted keywords strings (like"asis") and functions.I originally thought that repurposing (extending) an existing argument was an elegant solution. On reflection, however, I've come to realise that this overloading of
x/ylevelsis a bad idea. Not only is it brittle, but it isn't very intuitive. I now think we should:x/ylevelsas originally scoped: i.e., a literal ordering of a variable levels.x/yordarguments that derive the order of variables via keywords like"asis"and functions, which apply the appropriate operation on the data. Note that we already have precedent withbyordfor stacked area plots (Stacked area #688).These two functions should be mutually exclusive; privilege (the literal)
x/ylevelsover (the derived)x/yordif both are provided.