Skip to content

Commit 133a7cc

Browse files
committed
added check for 2 elements
1 parent ef9dfa7 commit 133a7cc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

prody/dynamics/plotting.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,15 +261,17 @@ def showProjection(ensemble, modes, *args, **kwargs):
261261
c = kwargs.pop('c', 'blue')
262262
colors = kwargs.pop('color', c)
263263

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

271273
if len(colors) != num:
272-
raise ValueError('length of color must be {0}'.format(num))
274+
raise ValueError('final length of color must be {0}'.format(num))
273275

274276
color_norm = None
275277
if isinstance(colors[0], Number):

0 commit comments

Comments
 (0)