mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-05 22:01:21 +08:00
ENH: Warn if using OverlayPlugin w/ matplotlib < 1.2
This commit is contained in:
@@ -1,8 +1,19 @@
|
||||
from warnings import warn
|
||||
|
||||
from skimage.util.dtype import dtype_range
|
||||
from .base import Plugin
|
||||
from ..utils import ClearColormap
|
||||
|
||||
|
||||
__all__ = ['OverlayPlugin']
|
||||
|
||||
|
||||
def recent_mpl_version():
|
||||
import matplotlib
|
||||
version = matplotlib.__version__.split('.')
|
||||
return int(version[0]) == 1 and int(version[1]) >= 2
|
||||
|
||||
|
||||
class OverlayPlugin(Plugin):
|
||||
"""Plugin for ImageViewer that displays an overlay on top of main image.
|
||||
|
||||
@@ -25,6 +36,9 @@ class OverlayPlugin(Plugin):
|
||||
'cyan': (0, 1, 1)}
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
if not recent_mpl_version():
|
||||
msg = "Matplotlib >= 1.2 required for OverlayPlugin."
|
||||
warn(RuntimeWarning(msg))
|
||||
super(OverlayPlugin, self).__init__(**kwargs)
|
||||
self._overlay_plot = None
|
||||
self._overlay = None
|
||||
|
||||
Reference in New Issue
Block a user