https://github.com/networkx/networkx/commit/eb3a675c5b2b15e33b0a4a35bcee34d6b81ed94d Replace cb.iterable with np.iterable (#3458) `matplotlib.cbook.iterable` is deprecated in matplotlib 3.1 https://matplotlib.org/3.1.0/api/cbook_api.html#matplotlib.cbook.iterable Fixes https://github.com/networkx/networkx/issues/3466 --- networkx/drawing/nx_pylab.py.orig 2019-04-11 14:52:34.000000000 -0600 +++ networkx/drawing/nx_pylab.py 2019-09-11 10:14:12.380878784 -0600 @@ -550,7 +550,6 @@ def draw_networkx_edges(G, pos, try: import matplotlib import matplotlib.pyplot as plt - import matplotlib.cbook as cb from matplotlib.colors import colorConverter, Colormap, Normalize from matplotlib.collections import LineCollection from matplotlib.patches import FancyArrowPatch @@ -576,13 +575,13 @@ def draw_networkx_edges(G, pos, # set edge positions edge_pos = np.asarray([(pos[e[0]], pos[e[1]]) for e in edgelist]) - if not cb.iterable(width): + if not np.iterable(width): lw = (width,) else: lw = width if not is_string_like(edge_color) \ - and cb.iterable(edge_color) \ + and np.iterable(edge_color) \ and len(edge_color) == len(edge_pos): if np.alltrue([is_string_like(c) for c in edge_color]): # (should check ALL elements) @@ -591,7 +590,7 @@ def draw_networkx_edges(G, pos, for c in edge_color]) elif np.alltrue([not is_string_like(c) for c in edge_color]): # If color specs are given as (rgb) or (rgba) tuples, we're OK - if np.alltrue([cb.iterable(c) and len(c) in (3, 4) + if np.alltrue([np.iterable(c) and len(c) in (3, 4) for c in edge_color]): edge_colors = tuple(edge_color) else: @@ -673,7 +672,7 @@ def draw_networkx_edges(G, pos, line_width = None shrink_source = 0 # space from source to tail shrink_target = 0 # space from head to target - if cb.iterable(node_size): # many node sizes + if np.iterable(node_size): # many node sizes src_node, dst_node = edgelist[i][:2] index_node = nodelist.index(dst_node) marker_size = node_size[index_node] @@ -797,7 +796,6 @@ def draw_networkx_labels(G, pos, """ try: import matplotlib.pyplot as plt - import matplotlib.cbook as cb except ImportError: raise ImportError("Matplotlib required for draw()") except RuntimeError: