Commit d0485540 authored by Martin Reinecke's avatar Martin Reinecke

only load matplotlib when needed

parent 386d2f0e
Pipeline #17979 passed with stage
in 4 minutes and 52 seconds
from __future__ import division from __future__ import division
import matplotlib.pyplot as plt
import numpy as np import numpy as np
from ..import Field, RGSpace, HPSpace, GLSpace, PowerSpace from ..import Field, RGSpace, HPSpace, GLSpace, PowerSpace
import os import os
...@@ -42,6 +41,7 @@ def _find_closest(A, target): ...@@ -42,6 +41,7 @@ def _find_closest(A, target):
return idx return idx
def _makeplot(name): def _makeplot(name):
import matplotlib.pyplot as plt
if name is None: if name is None:
plt.show() plt.show()
return return
...@@ -66,6 +66,7 @@ def _makeplot(name): ...@@ -66,6 +66,7 @@ def _makeplot(name):
raise ValueError("file format not understood") raise ValueError("file format not understood")
def plot (f,name=None): def plot (f,name=None):
import matplotlib.pyplot as plt
if not isinstance(f,Field): if not isinstance(f,Field):
raise TypeError("incorrect data type") raise TypeError("incorrect data type")
if len(f.domain)!=1: if len(f.domain)!=1:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment