Skip to content

Commit

Permalink
Fix error when we have too little data to have a cutoff
Browse files Browse the repository at this point in the history
  • Loading branch information
LourensVeen committed Sep 1, 2023
1 parent 3c920f5 commit f0e4d00
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions muscle3/profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,18 +297,19 @@ def update_data(self, ax: Axes) -> None:
for i in range(n_cur, n_avail):
bars[i].set_visible(False)

# update cutoff bars
bars = self._bars['_CUTOFF'].patches
if cutoff:
for bar in bars:
bar.set_x(cutoff)
bar.set_width(self._global_xmax - cutoff)
bar.set_visible(True)
self._cutoff_warning.set_visible(True)
else:
for bar in bars:
bar.set_visible(False)
self._cutoff_warning.set_visible(False)
# update cutoff bars, if any
if '_CUTOFF' in self._bars:
bars = self._bars['_CUTOFF'].patches
if cutoff:
for bar in bars:
bar.set_x(cutoff)
bar.set_width(self._global_xmax - cutoff)
bar.set_visible(True)
self._cutoff_warning.set_visible(True)
else:
for bar in bars:
bar.set_visible(False)
self._cutoff_warning.set_visible(False)


tplot = None # type: Optional[TimelinePlot]
Expand Down

0 comments on commit f0e4d00

Please sign in to comment.