codecov-io: # [Codecov](https://codecov.io/gh/kutaslab/fitgrid/pull/52?src=pr&el=h1) Report
> Merging [#52](https://codecov.io/gh/kutaslab/fitgrid/pull/52?src=pr&el=desc) into [master](https://codecov.io/gh/kutaslab/fitgrid/commit/5b4dae658d22e5aabfef7360c1c3a8e0a52da918?src=pr&el=desc) will **increase** coverage by `0.1%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/kutaslab/fitgrid/pull/52/graphs/tree.svg?width=650&token=d9xVBW7gSn&height=150&src=pr)](https://codecov.io/gh/kutaslab/fitgrid/pull/52?src=pr&el=tree)

```diff
@@            Coverage Diff            @@
##           master      #52     +/-   ##
=========================================
+ Coverage    78.9%   79.01%   +0.1%     
=========================================
  Files           8        8             
  Lines         403      405      +2     
=========================================
+ Hits          318      320      +2     
  Misses         85       85
```


| [Impacted Files](https://codecov.io/gh/kutaslab/fitgrid/pull/52?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [fitgrid/fitgrid.py](https://codecov.io/gh/kutaslab/fitgrid/pull/52/diff?src=pr&el=tree#diff-Zml0Z3JpZC9maXRncmlkLnB5) | `88.33% <100%> (+0.19%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/kutaslab/fitgrid/pull/52?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/kutaslab/fitgrid/pull/52?src=pr&el=footer). Last update [5b4dae6...edacbfe](https://codecov.io/gh/kutaslab/fitgrid/pull/52?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

diff --git a/fitgrid/fitgrid.py b/fitgrid/fitgrid.py
index 8569c1d..5cd5f5a 100644
--- a/fitgrid/fitgrid.py
+++ b/fitgrid/fitgrid.py
@@ -237,6 +237,10 @@ class FitGrid:
                 nrows=len(channels), figsize=figsize, sharey=True
             )
 
+            # wrap in list to allow for zipping later
+            if not isinstance(axes, np.ndarray):
+                axes = [axes]
+
             for ax, chan in zip(axes, channels):
                 for beta in params[chan]:
                     ax.plot(params[chan][beta], label=beta)

plot_betas fails on grid with single channel
Wrap `axes` in list when single object?
diff --git a/tests/test_fitgrid.py b/tests/test_fitgrid.py
index f14a93a..97d2d98 100644
--- a/tests/test_fitgrid.py
+++ b/tests/test_fitgrid.py
@@ -161,6 +161,15 @@ def test__smoke_plot_betas():
     grid.plot_betas()
 
 
+# https://github.com/kutaslab/fitgrid/issues/51
+def test__plot_betas_single_channel():
+
+    epochs = fitgrid.generate(n_samples=2, n_channels=1)
+
+    grid = epochs.lm(RHS='categorical + continuous')
+    grid.plot_betas()
+
+
 def test__smoke_plot_adj_rsquared():
 
     epochs = fitgrid.generate()

pip install -e .[dev]
parse_log_pytest
requirements.txt
black pytest pytest-cov
apt-get update apt-get install -y gcc
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
black==25.1.0
blosc2==2.5.1
click==8.1.8
contourpy==1.3.0
coverage==7.8.0
cycler==0.12.1
exceptiongroup==1.2.2
-e git+https://github.com/kutaslab/fitgrid.git@5b4dae658d22e5aabfef7360c1c3a8e0a52da918#egg=fitgrid
fonttools==4.56.0
importlib_resources==6.5.2
iniconfig==2.1.0
kiwisolver==1.4.7
matplotlib==3.9.4
msgpack==1.1.0
mypy-extensions==1.0.0
ndindex==1.9.2
numexpr==2.10.2
numpy==2.0.2
packaging==24.2
pandas==2.2.3
pathspec==0.12.1
patsy==1.0.1
pillow==11.1.0
platformdirs==4.3.7
pluggy==1.5.0
py-cpuinfo==9.0.0
pyparsing==3.2.3
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
pytz==2025.2
scipy==1.13.1
six==1.17.0
statsmodels==0.14.4
tables==3.9.2
tomli==2.2.1
tqdm==4.67.1
typing_extensions==4.13.0
tzdata==2025.2
zipp==3.21.0

name: fitgrid
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:
      - black==25.1.0
      - blosc2==2.5.1
      - click==8.1.8
      - contourpy==1.3.0
      - coverage==7.8.0
      - cycler==0.12.1
      - exceptiongroup==1.2.2
      - fonttools==4.56.0
      - importlib-resources==6.5.2
      - iniconfig==2.1.0
      - kiwisolver==1.4.7
      - matplotlib==3.9.4
      - msgpack==1.1.0
      - mypy-extensions==1.0.0
      - ndindex==1.9.2
      - numexpr==2.10.2
      - numpy==2.0.2
      - packaging==24.2
      - pandas==2.2.3
      - pathspec==0.12.1
      - patsy==1.0.1
      - pillow==11.1.0
      - platformdirs==4.3.7
      - pluggy==1.5.0
      - py-cpuinfo==9.0.0
      - pyparsing==3.2.3
      - pytest==8.3.5
      - pytest-cov==6.0.0
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - scipy==1.13.1
      - six==1.17.0
      - statsmodels==0.14.4
      - tables==3.9.2
      - tomli==2.2.1
      - tqdm==4.67.1
      - typing-extensions==4.13.0
      - tzdata==2025.2
      - zipp==3.21.0
prefix: /opt/conda/envs/fitgrid

tests/test_fitgrid.py::test__plot_betas_single_channel
tests/test_fitgrid.py::test__epoch_id_substitution tests/test_fitgrid.py::test__smoke_influential_epochs
tests/test_fitgrid.py::test__correct_channels_in_fitgrid tests/test_fitgrid.py::test__method_returning_dataframe_expands_correctly tests/test_fitgrid.py::test__residuals_have_long_form_and_correct_index tests/test_fitgrid.py::test__slicing tests/test_fitgrid.py::test__smoke_plot_betas tests/test_fitgrid.py::test__smoke_plot_adj_rsquared
fitgrid/fitgrid.py
fitgrid/fitgrid.py