From ee42b2bc39eb305e2a351896cec58fd7e665d5ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Boulogne?= Date: Sun, 12 Jun 2016 20:23:09 +0200 Subject: [PATCH] Import matplotlib inside _try_all --- skimage/filters/thresholding.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/skimage/filters/thresholding.py b/skimage/filters/thresholding.py index 3fac4a26..d3cc8ca5 100644 --- a/skimage/filters/thresholding.py +++ b/skimage/filters/thresholding.py @@ -2,7 +2,6 @@ import math import numpy as np from scipy import ndimage as ndi from scipy.ndimage import filters as ndif -from matplotlib import pyplot as plt from collections import OrderedDict from ..exposure import histogram from .._shared.utils import assert_nD, warn @@ -42,6 +41,8 @@ def _try_all(image, methods=None, figsize=None, num_cols=2, verbose=True): fig, ax : tuple Matplotlib figure and axes. """ + from matplotlib import pyplot as plt + num_rows = math.ceil((len(methods) + 1) / 2.) num_rows = int(num_rows) # Python 2.7 support fig, ax = plt.subplots(num_rows, num_cols, figsize=figsize,