Skip to content

Commit

Permalink
added check for 2 elements
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmkrieger committed Aug 26, 2020
1 parent 492c3ad commit 8325bb4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions prody/dynamics/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,17 @@ def showProjection(ensemble, modes, *args, **kwargs):
c = kwargs.pop('c', 'blue')
colors = kwargs.pop('color', c)

if isListLike(colors) and not len(colors) in [3, 4]:
if isListLike(colors) and len(colors) == 2:
raise ValueError('each entry of color should have 1, 3 or 4 values not 2')
elif isListLike(colors) and not len(colors) in [3, 4]:
colors = list(colors)
elif isinstance(colors, str) or colors is None or isListLike(colors):
colors = [colors] * num
else:
raise TypeError('color must be string or list-like or None')

if len(colors) != num:
raise ValueError('length of color must be {0}'.format(num))
raise ValueError('final length of color must be {0}'.format(num))

color_norm = None
if isinstance(colors[0], Number):
Expand Down

0 comments on commit 8325bb4

Please sign in to comment.