diff --git a/CHANGES.md b/CHANGES.md
index dc755b43..8f2a9392 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -18,6 +18,11 @@
 
 - ``alt.SortField`` renamed to ``alt.EncodingSortField`` and ``alt.WindowSortField`` renamed to ``alt.SortField`` (https://github.com/vega/vega-lite/pull/3741)
 
+### Bug Fixes
+
+- Fixed serialization of logical operands on selections within
+  ``transform_filter()``: (#1075)
+
 ## Version 2.1.0 (Released June 6, 2018):
 
 ### Enhancements
diff --git a/altair/vegalite/v2/api.py b/altair/vegalite/v2/api.py
index 2d46d218..ac413390 100644
--- a/altair/vegalite/v2/api.py
+++ b/altair/vegalite/v2/api.py
@@ -830,8 +830,12 @@ class TopLevelMixin(mixins.ConfigMethodMixin):
         alt.FilterTransform : underlying transform object
 
         """
+        selection_predicates = (core.SelectionNot, core.SelectionOr,
+                                core.SelectionAnd, core.SelectionOperand)
         if isinstance(filter, NamedSelection):
-            filter = filter.ref()
+            filter = {'selection': filter._get_name()}
+        elif isinstance(filter, selection_predicates):
+            filter = {'selection': filter}
         return self._add_transform(core.FilterTransform(filter=filter, **kwargs))
 
     def transform_lookup(self, as_=Undefined, from_=Undefined, lookup=Undefined, default=Undefined, **kwargs):

SelectionNot is not appropriately serialized
See https://github.com/altair-viz/altair/issues/695#issuecomment-411506890 and https://github.com/altair-viz/altair/issues/695#issuecomment-411536841
diff --git a/altair/vegalite/v2/tests/test_api.py b/altair/vegalite/v2/tests/test_api.py
index b59e1062..aeba0701 100644
--- a/altair/vegalite/v2/tests/test_api.py
+++ b/altair/vegalite/v2/tests/test_api.py
@@ -336,6 +336,24 @@ def test_transforms():
                                                        window=window[::-1])])
 
 
+def test_filter_transform_selection_predicates():
+    selector1 = alt.selection_interval(name='s1')
+    selector2 = alt.selection_interval(name='s2')
+    base = alt.Chart('data.txt').mark_point()
+
+    chart = base.transform_filter(selector1)
+    assert chart.to_dict()['transform'] == [{'filter': {'selection': 's1'}}]
+
+    chart = base.transform_filter(~selector1)
+    assert chart.to_dict()['transform'] == [{'filter': {'selection': {'not': 's1'}}}]
+
+    chart = base.transform_filter(selector1 & selector2)
+    assert chart.to_dict()['transform'] == [{'filter': {'selection': {'and': ['s1', 's2']}}}]
+
+    chart = base.transform_filter(selector1 | selector2)
+    assert chart.to_dict()['transform'] == [{'filter': {'selection': {'or': ['s1', 's2']}}}]
+
+
 
 def test_resolve_methods():
     chart = alt.LayerChart().resolve_axis(x='shared', y='independent')

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest
3.9
requirements/base.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.16
-e git+https://github.com/altair-viz/altair.git@c578fda2c2e19fb2345a7dd878e019b9edac1f51#egg=altair
asttokens==3.0.0
attrs==25.3.0
babel==2.17.0
certifi==2025.1.31
charset-normalizer==3.4.1
commonmark==0.9.1
decorator==5.2.1
docutils==0.21.2
entrypoints==0.4
exceptiongroup==1.2.2
executing==2.2.0
flake8==7.2.0
idna==3.10
imagesize==1.4.1
importlib_metadata==8.6.1
iniconfig==2.1.0
ipython==8.18.1
jedi==0.19.2
Jinja2==3.1.6
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
m2r==0.3.1
MarkupSafe==3.0.2
matplotlib-inline==0.1.7
mccabe==0.7.0
mistune==0.8.4
numpy==2.0.2
packaging==24.2
pandas==2.2.3
parso==0.8.4
pexpect==4.9.0
pluggy==1.5.0
prompt_toolkit==3.0.50
ptyprocess==0.7.0
pure_eval==0.2.3
pycodestyle==2.13.0
pyflakes==3.3.2
Pygments==2.19.1
pytest==8.3.5
python-dateutil==2.9.0.post0
pytz==2025.2
recommonmark==0.7.1
referencing==0.36.2
requests==2.32.3
rpds-py==0.24.0
six==1.17.0
snowballstemmer==2.2.0
Sphinx==7.4.7
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
stack-data==0.6.3
tomli==2.2.1
toolz==1.0.0
traitlets==5.14.3
typing==3.7.4.3
typing_extensions==4.13.0
tzdata==2025.2
urllib3==2.3.0
vega-datasets==0.9.0
wcwidth==0.2.13
zipp==3.21.0

name: altair
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.16
      - asttokens==3.0.0
      - attrs==25.3.0
      - babel==2.17.0
      - certifi==2025.1.31
      - charset-normalizer==3.4.1
      - commonmark==0.9.1
      - decorator==5.2.1
      - docutils==0.21.2
      - entrypoints==0.4
      - exceptiongroup==1.2.2
      - executing==2.2.0
      - flake8==7.2.0
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==8.6.1
      - iniconfig==2.1.0
      - ipython==8.18.1
      - jedi==0.19.2
      - jinja2==3.1.6
      - jsonschema==4.23.0
      - jsonschema-specifications==2024.10.1
      - m2r==0.3.1
      - markupsafe==3.0.2
      - matplotlib-inline==0.1.7
      - mccabe==0.7.0
      - mistune==0.8.4
      - numpy==2.0.2
      - packaging==24.2
      - pandas==2.2.3
      - parso==0.8.4
      - pexpect==4.9.0
      - pluggy==1.5.0
      - prompt-toolkit==3.0.50
      - ptyprocess==0.7.0
      - pure-eval==0.2.3
      - pycodestyle==2.13.0
      - pyflakes==3.3.2
      - pygments==2.19.1
      - pytest==8.3.5
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - recommonmark==0.7.1
      - referencing==0.36.2
      - requests==2.32.3
      - rpds-py==0.24.0
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==7.4.7
      - sphinxcontrib-applehelp==2.0.0
      - sphinxcontrib-devhelp==2.0.0
      - sphinxcontrib-htmlhelp==2.1.0
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==2.0.0
      - sphinxcontrib-serializinghtml==2.0.0
      - stack-data==0.6.3
      - tomli==2.2.1
      - toolz==1.0.0
      - traitlets==5.14.3
      - typing==3.7.4.3
      - typing-extensions==4.13.0
      - tzdata==2025.2
      - urllib3==2.3.0
      - vega-datasets==0.9.0
      - wcwidth==0.2.13
      - zipp==3.21.0
prefix: /opt/conda/envs/altair

altair/vegalite/v2/tests/test_api.py::test_filter_transform_selection_predicates
altair/vegalite/v2/tests/test_api.py::test_chart_data_types altair/vegalite/v2/tests/test_api.py::test_chart_infer_types altair/vegalite/v2/tests/test_api.py::test_facet_parse_data altair/vegalite/v2/tests/test_api.py::test_LookupData altair/vegalite/v2/tests/test_api.py::test_consolidate_datasets
altair/vegalite/v2/tests/test_api.py::test_multiple_encodings altair/vegalite/v2/tests/test_api.py::test_chart_operations altair/vegalite/v2/tests/test_api.py::test_selection_to_dict altair/vegalite/v2/tests/test_api.py::test_facet_parse altair/vegalite/v2/tests/test_api.py::test_SelectionMapping altair/vegalite/v2/tests/test_api.py::test_transforms altair/vegalite/v2/tests/test_api.py::test_resolve_methods altair/vegalite/v2/tests/test_api.py::test_add_selection altair/vegalite/v2/tests/test_api.py::test_themes altair/vegalite/v2/tests/test_api.py::test_chart_from_dict
altair/vegalite/v2/api.py CHANGES.md
altair/vegalite/v2/api.py CHANGES.md