Skip to content

Commit

Permalink
AMD: mark_difference()
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbrodbeck committed Apr 30, 2021
1 parent 6a0b757 commit 34d8d29
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion eelbrain/plot/_decorations.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def mark_difference(
nudge: Union[bool, float] = None,
location: Literal['top', 'bottom', 'left', 'right'] = 'top',
ax: matplotlib.axes.Axes = None,
line_args: dict = None,
**text_args,
):
"""Mark a pair of categories with a line and a label
Expand Down Expand Up @@ -43,6 +44,8 @@ def mark_difference(
Location relative to plots.
ax
Axes to which to plot (default is ``pyplot.gca()``).
line_args
Additional parameters for :func:`matplotlib.pyplot.plot`.
...
All other parameters are used to plot the text label with
:meth:`matplotlib.axes.Axes.text`.
Expand Down Expand Up @@ -92,7 +95,10 @@ def mark_difference(
xs, ys = ys, xs
x_text, y_text = y_text, x_text

ax.plot(xs, ys, color=color)
line_args_ = {'color': color, 'clip_on': False}
if line_args:
line_args_.update(line_args)
ax.plot(xs, ys, **line_args_)
if label:
rotation = {'top': 0, 'left': 90, 'bottom': 180, 'right': 270}[location]
args = {'ha': 'center', 'va': 'center', 'rotation': rotation, 'clip_on': False, **text_args}
Expand Down

0 comments on commit 34d8d29

Please sign in to comment.