From 26cf5cc828cd543d6ac538899bca8015573a6059 Mon Sep 17 00:00:00 2001
From: Joseph Weston <joseph.weston08@gmail.com>
Date: Wed, 14 Jun 2017 18:29:17 +0200
Subject: [PATCH] ignore warnings from the plotter about canvas being None

---
 kwant/plotter.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/kwant/plotter.py b/kwant/plotter.py
index e64f032b..c6933789 100644
--- a/kwant/plotter.py
+++ b/kwant/plotter.py
@@ -1770,8 +1770,13 @@ def spectrum(syst, x, y=None, params=None, mask=None, file=None,
         if fig_size is not None:
             fig.set_figwidth(fig_size[0])
             fig.set_figheight(fig_size[1])
-        projection = '3d' if y is not None else None
-        ax = fig.add_subplot(1, 1, 1, projection=projection)
+        if y is None:
+            ax = fig.add_subplot(1, 1, 1)
+        else:
+            warnings.filterwarnings('ignore',
+                                    message=r'.*mouse rotation disabled.*')
+            ax = fig.add_subplot(1, 1, 1, projection='3d')
+            warnings.resetwarnings()
         ax.set_xlabel(keys[0])
         if y is None:
             ax.set_ylabel('Energy')
-- 
GitLab