altair.condition

altair.condition(predicate, if_true, if_false, **kwargs)

A conditional attribute or encoding

Parameters:
predicate: NamedSelection, LogicalOperandPredicate, expr.Expression, dict, or string

the selection predicate or test predicate for the condition. if a string is passed, it will be treated as a test operand.

if_true:

the spec or object to use if the selection predicate is true

if_false:

the spec or object to use if the selection predicate is false

**kwargs:

additional keyword args are added to the resulting dict

Returns:
spec: dict or VegaLiteSchema

the spec that describes the condition