update example to use altKey (optionKey) on macOS
@@ -254,20 +254,23 @@ over them with your mouse:
Composing Multiple Selections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Altair also supports combining multiple selections using the `&`, `|` and `~`
-for respectively `AND`, `OR` and `NOT` logical composition operands.
-
-In the following example there are two people who can make an interval selection
-in the chart. The person Alex makes an selection box when the control-key is
-selected and Morgan can make an selection box when the shift-key is selected.
+Altair also supports combining multiple selections using the ``&``, ``|``
+and ``~`` for respectively ``AND``, ``OR`` and ``NOT`` logical composition
+operands.
+
+In the following example there are two people who can make an interval
+selection in the chart. The person Alex makes a selection box when the
+alt-key (macOS: option-key) is selected and Morgan can make a selection
+box when the shift-key is selected.
We use the alt.Brushconfig() to give the selection box of Morgan a different
style.
-Now, we color the rectangles when they fall within Alex's or Morgan's selection.
+Now, we color the rectangles when they fall within Alex's or Morgan's
+selection.
.. altair-plot::
alex = alt.selection_interval(
- on="[mousedown[event.ctrlKey], mouseup] > mousemove",
+ on="[mousedown[event.altKey], mouseup] > mousemove",
name='alex'
)
morgan = alt.selection_interval(
@@ -289,10 +292,11 @@ Now, we color the rectangles when they fall within Alex's or Morgan's selection.
With these operators, selections can be combined in arbitrary ways:
-- "selection": {"not": {"and": ["alex", "morgan"]}}: to select the rectangles
-that fall outside Alex's and Morgan's selections.
-- alex | ~morgan: to select the rectangles that fall within Alex's selection or
-outside the selection of Morgan
+- ``~(alex & morgan)``: to select the rectangles that fall outside
+ Alex's and Morgan's selections.
+
+- ``alex | ~morgan``: to select the rectangles that fall within Alex's
+ selection or outside the selection of Morgan
Selection Targets: Fields and Encodings
