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 adds a new
Scale
object,Boolean
, that has a domain ofTrue
andFalse
.There's a bit of a tension with boolean data: True/False can be (and often are) cast to 0/1 and treated numerically, but (even when using True and False as labels) it feels odd to sort them such that axes or legends read "False, True". Therefore, this scale aims to maintain a True, False ordering.
The scale is used by default for data with dtype
bool
,"boolean"
(pandas' na-aware dtype), or object types (including bare Python lists) with only True/False values:It can also be assigned manually, which will also cast the input values to booleans:
There aren't currently many options; maybe it makes sense to add some, but for now it just accepts a single
values
parameter which is relevant for semantic properties (e.g., it can be a list of colors, or a palette name, or a range of point sizes, etc.).