Predicates
The first argument tohighlight() is a predicate — a test against your post-transform columns. Field predicates name a variable and a comparison:
Ordered operators (
gt, gte, lt, lte, range) need a numeric or date
column. Using one against a categorical field is a compile-time validation
error, surfaced as a diagnostic
rather than a silent no-op.and, or, and not:
Scope
By default a highlight matches individual observations. Thescope option expands each match to a larger visual unit:
Scoping to one layer
In a multi-layer chart (say bars plus a trend line), bind the highlight to a single layer: name the layer withid and point at it with layerId. Observations in other layers are never tested, so a Q4 highlight on the bars leaves the trend line untouched:
layerId to evaluate the predicate against every layer. A layer you never name gets an id assigned at resolve time, so scoping is the one case where naming it yourself matters.
Combining highlights
Multiplehighlight() calls accumulate, and the engine unions their matches — an observation matched by any highlight is emphasised. So two separate highlights behave like an or:
or, this is equivalent to a single highlight with an or predicate — same matched observations, same result:
or predicate when the two conditions are one idea; reach for two separate highlights when they’re independent emphases you might toggle separately.
Styling the de-emphasis
How the un-matched observations recede is stylesheet paint: entries scoped to the'dimmed' state. The built-in stylesheet dims to alpha: 0.4; declare your own dimmed entry to change the look:
alpha lowers the opacity of non-matched observations; saturation: 0 drains their color toward grey.
Related
- Mappings & aesthetics — the variables a predicate can name
- Transforms — predicates run against post-transform columns
- Geoms — the stylesheet the dimmed entries live in

