Better access to logical operand predicates
See original GitHub issueVega-Lite has a number of logical operands; e.g.
alt.LogicalAndPredicate
alt.LogicalOrPredicate
alt.LogicalNotPredicate
These come up, for example, in constructing filter transforms. It would be useful to make these available to Altair users via Python’s logical operators, &
, |
, and ~
, respectively.
There are two challenges:
-
How to implement them effectively… maybe create some sort of
PredicateMixin
for these classes? If we were constructing the wrapper classes by hand, it would make sense foralt.Predicate
to be the base class of each of these logical predicates… perhaps we should change the code generation framework so that this kind of class hierarchy is (optionally) inferred in generated classes? Sounds hard to do well in a general way, though. -
The interaction with selection operands (e.g.
alt.SelectionOr
,alt.SelectionAnd
,alt.SelectionNot
, andalt.NamedSelection
) makes this a bit tricky, becauseNamedSelection
objects serve two purposes in Altair (they act both as aalt.SelectionDef
and aalt.SelectionPredicate
depending on the context).
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (6 by maintainers)
Top GitHub Comments
Yes, you can do them in Altair. But no, you can’t have
or
andnot
as keys within the same object… I’m not quite sure how to interpret your intent here.Is this what you were intending to do?
@breadbaron fixed in #1075, which will make it into the 2.2 release 😄