Skip to content
Snippets Groups Projects
Commit d0485540 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

only load matplotlib when needed

parent 386d2f0e
No related branches found
No related tags found
No related merge requests found
Pipeline #
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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment