diff --git a/skimage/viewer/canvastools/base.py b/skimage/viewer/canvastools/base.py index 288d12ea..8b631d38 100644 --- a/skimage/viewer/canvastools/base.py +++ b/skimage/viewer/canvastools/base.py @@ -1,7 +1,6 @@ import numpy as np try: - import matplotlib as mpl from matplotlib import lines except ImportError: print("Could not import matplotlib -- skimage.viewer not available.") @@ -16,19 +15,17 @@ class CanvasToolBase(object): Parameters ---------- """ - def __init__(self, ax, useblit=None, on_update=None, on_enter=None): + def __init__(self, ax, useblit=True, on_update=None, on_enter=None): self.ax = ax self.canvas = ax.figure.canvas self.cids = [] self._artists = [] self.active = True - if useblit is None: - useblit = True if mpl.backends.backend.endswith('Agg') else False - self.useblit = useblit if useblit: self.canvas.draw() self.img_background = self.canvas.copy_from_bbox(self.ax.bbox) + self.useblit = useblit if on_update is None: on_update = lambda *args: None diff --git a/skimage/viewer/plugins/base.py b/skimage/viewer/plugins/base.py index 198bac6a..cc6352dc 100644 --- a/skimage/viewer/plugins/base.py +++ b/skimage/viewer/plugins/base.py @@ -9,11 +9,6 @@ except ImportError: QDialog = object # hack to prevent nosetest and autodoc errors print("Could not import PyQt4 -- skimage.viewer not available.") -try: - import matplotlib as mpl -except ImportError: - print("Could not import matplotlib -- skimage.viewer not available.") - from ..utils import RequiredAttr, init_qtapp @@ -81,7 +76,7 @@ class Plugin(QDialog): image_viewer = RequiredAttr("%s is not attached to ImageViewer" % name) draws_on_image = False - def __init__(self, image_filter=None, height=0, width=400, useblit=None): + def __init__(self, image_filter=None, height=0, width=400, useblit=True): init_qtapp() super(Plugin, self).__init__() @@ -98,8 +93,6 @@ class Plugin(QDialog): self.arguments = [] self.keyword_arguments= {} - if useblit is None: - useblit = True if mpl.backends.backend.endswith('Agg') else False self.useblit = useblit self.cids = [] self.artists = [] diff --git a/skimage/viewer/plugins/lineprofile.py b/skimage/viewer/plugins/lineprofile.py index 09aa5d7e..1f9e046e 100644 --- a/skimage/viewer/plugins/lineprofile.py +++ b/skimage/viewer/plugins/lineprofile.py @@ -103,7 +103,6 @@ class LineProfile(PlotPlugin): def line_changed(self, end_pts): x, y = np.transpose(end_pts) - self.end_pts = end_pts scan = profile_line(self.image_viewer.original_image, end_pts, linewidth=self.line_tool.linewidth)