Skip to content

Commit

Permalink
ENH plot ticklabels: use grid-spec
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbrodbeck committed Jun 10, 2021
1 parent 1b15b6e commit 26b1777
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
31 changes: 16 additions & 15 deletions eelbrain/plot/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1811,23 +1811,24 @@ def _configure_axis(
nax = len(axes)
if isinstance(ticklabels, bool):
show_ticklabels = [ticklabels] * nax
elif isinstance(ticklabels, str):
if ticklabels == 'bottom':
show_ticklabels = [ax.get_subplotspec().is_last_row() for ax in axes]
elif ticklabels == 'left':
show_ticklabels = [ax.get_subplotspec().is_first_col() for ax in axes]
elif ticklabels == 'all':
show_ticklabels = [True] * nax
elif ticklabels == 'none':
show_ticklabels = [False] * nax
else:
raise ValueError(f"ticklabels={ticklabels!r}")
else:
if isinstance(ticklabels, str):
if ticklabels == 'bottom':
ticklabels = range(-min(self._layout.ncol, nax), 0)
elif ticklabels == 'left':
ticklabels = range(0, nax, self._layout.ncol)
elif ticklabels == 'all':
ticklabels = [True] * nax
elif ticklabels == 'none':
ticklabels = [False] * nax
else:
raise ValueError(f"ticklabels={ticklabels!r}")
elif isinstance(ticklabels, int):
ticklabels = [ticklabels]
show_ticklabels = [False] * nax
for i in ticklabels:
show_ticklabels[i] = True
if isinstance(ticklabels, int):
show_ticklabels[ticklabels] = True
else:
for i in ticklabels:
show_ticklabels[i] = True

# parameter for hiding tick-labels
if axis == 'y':
Expand Down
2 changes: 1 addition & 1 deletion env-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies:
- numpy >= 1.20
- scipy >= 1.5
- numba
- matplotlib-base >= 3.3.4 # https://github.com/matplotlib/matplotlib/issues/15410
- matplotlib-base >= 3.4 # https://github.com/matplotlib/matplotlib/issues/15410
- pyarrow
- pillow
- psutil
Expand Down

0 comments on commit 26b1777

Please sign in to comment.