Skip to content

Commit

Permalink
Change cbook.iterable to np.iterable
Browse files Browse the repository at this point in the history
Matplotlib 3.1.0 has deprecated cbook.iterable.
  • Loading branch information
stonebig authored and has2k1 committed May 9, 2019
1 parent 566e579 commit eed6dac
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions plotnine/utils.py
Expand Up @@ -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
Expand All @@ -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):
Expand All @@ -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]

Expand All @@ -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.')
Expand Down Expand Up @@ -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):
Expand Down

2 comments on commit eed6dac

@nicksspirit
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey great job with this package, I wanted to ask when will the new version of plotnine with this commit be available?

Thank you

@yunfeiguo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto, would love to see this being released sooner to get rid of the annoying warnings.

Please sign in to comment.