From eed6daca57ca5038f7695b060f88e81f066853c0 Mon Sep 17 00:00:00 2001 From: stonebig Date: Thu, 9 May 2019 22:02:41 +0200 Subject: [PATCH] Change cbook.iterable to np.iterable Matplotlib 3.1.0 has deprecated cbook.iterable. --- plotnine/utils.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plotnine/utils.py b/plotnine/utils.py index 8a967a90f..ea3d592d8 100644 --- a/plotnine/utils.py +++ b/plotnine/utils.py @@ -11,7 +11,6 @@ import numpy as np import pandas as pd import pandas.api.types as pdtypes -import matplotlib.cbook as cbook import matplotlib.colors as mcolors from matplotlib.colors import colorConverter from matplotlib.offsetbox import DrawingArea @@ -33,7 +32,7 @@ def is_scalar_or_string(val): """ Return whether the given object is a scalar or string like. """ - return is_string(val) or not cbook.iterable(val) + return is_string(val) or not np.iterable(val) def is_string(obj): @@ -51,7 +50,7 @@ def make_iterable(val): Strings are not recognized as iterables """ - if cbook.iterable(val) and not is_string(val): + if np.iterable(val) and not is_string(val): return val return [val] @@ -66,7 +65,7 @@ def make_iterable_ntimes(val, n): Raises an exception if *val* is an iterable but has length not equal to n """ - if cbook.iterable(val) and not is_string(val): + if np.iterable(val) and not is_string(val): if len(val) != n: raise PlotnineError( '`val` is an iterable of length not equal to n.') @@ -554,7 +553,7 @@ def to_rgba(colors, alpha): list-likes and the alpha dimension will be respected. """ def is_iterable(var): - return cbook.iterable(var) and not is_string(var) + return np.iterable(var) and not is_string(var) def has_alpha(c): if isinstance(c, tuple):