ENH: Warn if using OverlayPlugin w/ matplotlib < 1.2

This commit is contained in:
Tony S Yu
2012-12-16 22:49:12 -05:00
parent 23d24862ec
commit 0e08acd7c9
+14
View File
@@ -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