`ValueError: array of sample points is empty` when plotting trajectories (e.g., in SuperAnimal inference)

Is there an existing issue for this?

  • I have searched the existing issues

Bug description

When plotting trajectories of a bodypart where no predictions are made (or all are below the plotting threshold), matplotlib versions 3.7.0 and 3.7.1 fail with error ValueError: array of sample points is empty.

This issue cannot be reproduced with matplotlib<3.7.0 and matplotlib>=3.7.2 (it was fixed by matplotlib/matplotlib#25978).

Operating System

macOS

DeepLabCut version

dlc version 2.3.8

DeepLabCut mode

multi animal

Device type

gpu

Steps To Reproduce

No response

Relevant log output

Traceback (most recent call last):
  File "/DeepLabCut/deeplabcut/utils/plotting.py", line 398, in _plot_trajectories
    PlottingResults(
  File "/DeepLabCut/deeplabcut/utils/plotting.py", line 109, in PlottingResults
    ax1.plot(temp_x, temp_y, ".", color=colors(bpindex), alpha=alphavalue)
  File "/.../site-packages/matplotlib/axes/_axes.py", line 1690, in plot
    self.add_line(line)
  File "/.../site-packages/matplotlib/axes/_base.py", line 2304, in add_line
    self._update_line_limits(line)
  File "/.../site-packages/matplotlib/axes/_base.py", line 2327, in _update_line_limits
    path = line.get_path()
  File "/.../site-packages/matplotlib/lines.py", line 1029, in get_path
    self.recache()
  File "/.../site-packages/matplotlib/lines.py", line 681, in recache
    self._x_filled[nanmask] = np.interp(
  File "<__array_function__ internals>", line 180, in interp
  File "/.../site-packages/numpy/lib/function_base.py", line 1594, in interp
    return interp_func(x, xp, fp, left, right)
ValueError: array of sample points is empty

Anything else?

No response

Code of Conduct