This website is for version 5. You can find the documentation for version 4 here.

altair.condition#

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

A conditional attribute or encoding

Parameters:
predicate: Parameter, PredicateComposition, 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