From 6c54f431788360716ee9fe543d697244581445e7 Mon Sep 17 00:00:00 2001 From: Anton Akhmerov <anton.akhmerov@gmail.com> Date: Tue, 1 Jul 2014 14:55:31 +0200 Subject: [PATCH] simplify cmap logic --- kwant/plotter.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/kwant/plotter.py b/kwant/plotter.py index 694f84d9..88cb7256 100644 --- a/kwant/plotter.py +++ b/kwant/plotter.py @@ -1275,12 +1275,8 @@ def plot(sys, num_lead_cells=2, unit='nn', hop_cmap = None if not isinstance(cmap, basestring): try: - if len(cmap) != 2: - raise ValueError("if cmap is a sequence, it must have exactly " - "two entries") - hop_cmap = cmap[1] - cmap = cmap[0] - except (TypeError, KeyError): + cmap, hop_cmap = cmap + except TypeError: pass # make a new figure unless axes specified -- GitLab