[query/ggplot] fixes legend behavior for single-category columns #12913
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.
CHANGELOG: Fixed bug in
hail.ggplot
where all legend entries would have the same text if one column had exactly one value for all rows and was mapped to either theshape
or thecolor
aesthetic forgeom_point
.This change fixes an edge case that was encountered where, if the user creates a scatter plot and assigns one column with multiple values in it to the
color
aesthetic and one column with exactly one value in it to theshape
aesthetic (or vice versa), the plot has a legend which contains the correct visual entries, but they are all labelled with the value from the single-value column, instead of the labels from the other column.For a concrete example, this code:
Produces a graph like this one:
When it should instead produce one like this:
Further complicating matters, the first graph cannot be reproduced consistently due to the nature of the bug. See my comment on the code below for more information.