diff --git a/bvp/plots.py b/bvp/plots.py
index 1e3bd15..63ca96a 100644
--- a/bvp/plots.py
+++ b/bvp/plots.py
@@ -17,20 +17,31 @@ def _xy_order(domain: List, dist: List, vertical_violin: bool):
         return domain, dist
 
 
-def _plot_from_x_dist(axis, x, y, index, kwargs, vertical_violins):
+def _plot_from_x_dist(
+    axis, x, y, index, kwargs, vertical_violins, sides="both"
+):
     scale = 0.4 / y.max()
     # left side
-    axis.plot(
-        *_xy_order(x, index - y * scale, vertical_violins), **kwargs,
-    )
-    # right side
-    axis.plot(
-        *_xy_order(x, index + y * scale, vertical_violins), **kwargs,
-    )
+    if sides in ["both", "left", "top"]:
+        axis.plot(
+            *_xy_order(x, index - y * scale, vertical_violins), **kwargs,
+        )
+    if sides in ["both", "right", "bottom"]:
+        # right side
+        axis.plot(
+            *_xy_order(x, index + y * scale, vertical_violins), **kwargs,
+        )
     return
 
 
-def _preamble(data, axis, plot_kwargs, positions, vertical_violins):
+def _preamble(
+    data, axis, plot_kwargs, positions, vertical_violins, sides="both"
+):
+    if vertical_violins is True:
+        assert sides in ["both", "left", "right"]
+    else:  # horizontal violins
+        assert sides in ["both", "top", "bottom"]
+
     if axis is None:
         fig, axis = plt.subplots()
     else:
@@ -58,6 +69,7 @@ def analytic_violin(
     positions: Optional[List[int]] = None,
     axis: Optional["mpl.axes.Axes"] = None,
     vertical_violins: bool = True,
+    sides: str = "both",
     plot_kwargs: Union[Dict[str, Any], List[Dict[str, Any]]] = {
         "color": "black",
     },
@@ -86,6 +98,7 @@ def analytic_violin(
         positions (Optional[List[int]]): locations to plot the violins
         axis (mpl.axes.Axes): axis to use for plotting, default `None`
         vertical_violins (bool): flag to indicate orientation
+        sides (str): string to indicate where to put the plot
         plot_kwargs (Dict or List): if Dict, a dictionary of keyword-value
             pairs to pass to each plot routine. If List, it is a list of
             Dict objects to pass, one for each plot routine
@@ -94,7 +107,7 @@ def analytic_violin(
         interval (Optional[List[float]]): plotting interval; default `None`
     """
     fig, axis, positions = _preamble(
-        distributions, axis, plot_kwargs, positions, vertical_violins
+        distributions, axis, plot_kwargs, positions, vertical_violins, sides,
     )
 
     if sigma is not None and interval is not None:
@@ -131,11 +144,15 @@ def analytic_violin(
                 for j in range(1, len(xs)):
                     x = np.hstack((x, [xs[j], xs[j] + 1]))
                     y = np.hstack((y, [ys[j] * scale, ys[j] * scale]))
-                _plot_from_x_dist(axis, x, y, i, kwargs, vertical_violins)
+                _plot_from_x_dist(
+                    axis, x, y, i, kwargs, vertical_violins, sides
+                )
             elif isinstance(d.dist, rv_continuous):
                 x = np.linspace(min(interval), max(interval), 1000)
                 y = d.pdf(x)
-                _plot_from_x_dist(axis, x, y, i, kwargs, vertical_violins)
+                _plot_from_x_dist(
+                    axis, x, y, i, kwargs, vertical_violins, sides
+                )
             else:  # need to do random draws
                 raise NotImplementedError(
                     "only scipy.stats distributions supported"
@@ -153,6 +170,7 @@ def kde_violin(
     positions: Optional[List[int]] = None,
     axis: Optional["mpl.axes.Axes"] = None,
     vertical_violins: bool = True,
+    sides: str = "both",
     plot_kwargs: Union[Dict[str, Any], List[Dict[str, Any]]] = {
         "color": "black",
     },
@@ -197,7 +215,7 @@ def kde_violin(
     points = np.atleast_2d(points)
 
     fig, axis, positions = _preamble(
-        points, axis, plot_kwargs, positions, vertical_violins
+        points, axis, plot_kwargs, positions, vertical_violins, sides
     )
 
     if sigma is not None and interval is not None:
@@ -230,7 +248,7 @@ def kde_violin(
         # Make the domain and range
         x = np.linspace(min(interval), max(interval), 1000)
         y = kde(x)
-        _plot_from_x_dist(axis, x, y, i, kwargs, vertical_violins)
+        _plot_from_x_dist(axis, x, y, i, kwargs, vertical_violins, sides)
 
     return fig, axis
 

Add single-sided violins
Add an argument to all violin plotting functions to allow someone to specify left, right, up or down violin sides only (depending on the orientation).

For instance:
```python
def analytic_violin(..., sides="both", vertical_violins=True):
  if vertical_violins is True:
    assert sides in ["both", "left", "right"]
  else:  # horizontal violins
    assert sides in ["both", "top", "bottom"]
  # 'sides' affects the plotting function as well.
  ...
```
diff --git a/tests/test_plots.py b/tests/test_plots.py
index 5eb67f4..ab3b8b7 100644
--- a/tests/test_plots.py
+++ b/tests/test_plots.py
@@ -36,6 +36,14 @@ class analytic_violin_test(TestCase):
         with pytest.raises(AssertionError):
             analytic_violin(self.dists, plot_kwargs=[{}, {}, {}])
 
+    def test_sides_asserts(self):
+        with pytest.raises(AssertionError):
+            analytic_violin(self.dists, sides="top", vertical_violins=True)
+        with pytest.raises(AssertionError):
+            analytic_violin(self.dists, sides="left", vertical_violins=False)
+        with pytest.raises(AssertionError):
+            analytic_violin(self.dists, sides="blag")
+
 
 class kde_violin_test(TestCase):
     def setUp(self):
@@ -56,6 +64,14 @@ class kde_violin_test(TestCase):
         with pytest.raises(AssertionError):
             kde_violin(self.samples, plot_kwargs=[{}, {}, {}])
 
+    def test_sides_asserts(self):
+        with pytest.raises(AssertionError):
+            kde_violin(self.dists, sides="top", vertical_violins=True)
+        with pytest.raises(AssertionError):
+            kde_violin(self.dists, sides="left", vertical_violins=False)
+        with pytest.raises(AssertionError):
+            kde_violin(self.dists, sides="blag")
+
 
 class boxplot_test(TestCase):
     def setUp(self):

pip install -e .
parse_log_pytest
requirements.txt
pytest
3.7
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.13
Babel==2.14.0
black==23.3.0
-e git+https://github.com/tmcclintock/BetterViolinPlots.git@3d94f7285ea7af3a6c599d9c3c5344e6d4e4f661#egg=bvp
certifi @ file:///croot/certifi_1671487769961/work/certifi
cfgv==3.3.1
charset-normalizer==3.4.1
click==8.1.8
coverage==7.2.7
cycler==0.11.0
distlib==0.3.9
docutils==0.17.1
exceptiongroup==1.2.2
filelock==3.12.2
flake8==5.0.4
fonttools==4.38.0
identify==2.5.24
idna==3.10
imagesize==1.4.1
importlib-metadata==4.2.0
iniconfig==2.0.0
Jinja2==3.1.6
kiwisolver==1.4.5
MarkupSafe==2.1.5
matplotlib==3.5.3
mccabe==0.7.0
mypy-extensions==1.0.0
nodeenv==1.9.1
numpy==1.21.6
packaging==24.0
pathspec==0.11.2
Pillow==9.5.0
platformdirs==2.6.2
pluggy==1.2.0
pre-commit==2.21.0
pycodestyle==2.9.1
pyflakes==2.5.0
Pygments==2.17.2
pyparsing==3.1.4
pytest==7.4.4
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.1
requests==2.31.0
scipy==1.7.3
six==1.17.0
snowballstemmer==2.2.0
Sphinx==4.3.2
sphinx-rtd-theme==1.3.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
tomli==2.0.1
typed-ast==1.5.5
typing_extensions==4.7.1
urllib3==2.0.7
virtualenv==20.16.2
zipp==3.15.0

name: BetterViolinPlots
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
  - certifi=2022.12.7=py37h06a4308_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=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.13
      - babel==2.14.0
      - black==23.3.0
      - bvp==0.1
      - cfgv==3.3.1
      - charset-normalizer==3.4.1
      - click==8.1.8
      - coverage==7.2.7
      - cycler==0.11.0
      - distlib==0.3.9
      - docutils==0.17.1
      - exceptiongroup==1.2.2
      - filelock==3.12.2
      - flake8==5.0.4
      - fonttools==4.38.0
      - identify==2.5.24
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==4.2.0
      - iniconfig==2.0.0
      - jinja2==3.1.6
      - kiwisolver==1.4.5
      - markupsafe==2.1.5
      - matplotlib==3.5.3
      - mccabe==0.7.0
      - mypy-extensions==1.0.0
      - nodeenv==1.9.1
      - numpy==1.21.6
      - packaging==24.0
      - pathspec==0.11.2
      - pillow==9.5.0
      - platformdirs==2.6.2
      - pluggy==1.2.0
      - pre-commit==2.21.0
      - pycodestyle==2.9.1
      - pyflakes==2.5.0
      - pygments==2.17.2
      - pyparsing==3.1.4
      - pytest==7.4.4
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - pyyaml==6.0.1
      - requests==2.31.0
      - scipy==1.7.3
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==4.3.2
      - sphinx-rtd-theme==1.3.0
      - sphinxcontrib-applehelp==1.0.2
      - sphinxcontrib-devhelp==1.0.2
      - sphinxcontrib-htmlhelp==2.0.0
      - sphinxcontrib-jquery==4.1
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==1.0.3
      - sphinxcontrib-serializinghtml==1.1.5
      - tomli==2.0.1
      - typed-ast==1.5.5
      - typing-extensions==4.7.1
      - urllib3==2.0.7
      - virtualenv==20.16.2
      - zipp==3.15.0
prefix: /opt/conda/envs/BetterViolinPlots

tests/test_plots.py::analytic_violin_test::test_sides_asserts tests/test_plots.py::kde_violin_test::test_sides_asserts
tests/test_plots.py::analytic_violin_test::test_asserts tests/test_plots.py::analytic_violin_test::test_smoke_continuous tests/test_plots.py::analytic_violin_test::test_smoke_discrete tests/test_plots.py::kde_violin_test::test_asserts tests/test_plots.py::kde_violin_test::test_smoke_continuous tests/test_plots.py::boxplot_test::test_asserts tests/test_plots.py::boxplot_test::test_smoke_basic tests/test_plots.py::boxplot_test::test_smoke_kwargs tests/test_plots.py::_xy_order_test::test_correct_orders
bvp/plots.py
bvp/plots.py