-
-
Notifications
You must be signed in to change notification settings - Fork 830
Open
Labels
Milestone
Description
Writing a condition that matches a single value in relatively straightforward:
import altair as alt
from vega_datasets import data
source = data.cars()
alt.Chart(source).mark_point().encode(
x='Horsepower',
y='Miles_per_Gallon',
color=alt.condition(
alt.datum.Origin == 'Japan',
alt.value('red'),
alt.value('grey')
)
)But when we want to match multiple values, the alt.datum.Origin == 'Japan', needs to be replaced with the notably more compllicated:
alt.FieldOneOfPredicate(
'Origin',
['Japan', 'Europe']
),It would be nice to support the in operator here and allow the syntax to just be alt.datum.Origin in ['Japan', 'Europe']. I haven't looked into the change necessary to make this happen but noting it down as something to revisit in the future.
binste