diff options
author | James Myatt <james@jamesmyatt.co.uk> | 2019-06-06 07:34:37 +0100 |
---|---|---|
committer | Dan Schult <dschult@colgate.edu> | 2019-06-06 16:34:36 +1000 |
commit | eb3a675c5b2b15e33b0a4a35bcee34d6b81ed94d (patch) | |
tree | 0db0ba3715ea503c54f43e1717bad291a766833b | |
parent | 98328a04c8ee7b03e31b27c00b03fc2f5975160e (diff) | |
download | networkx-eb3a675c5b2b15e33b0a4a35bcee34d6b81ed94d.tar.gz |
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 #3466
-rw-r--r-- | networkx/drawing/nx_pylab.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/networkx/drawing/nx_pylab.py b/networkx/drawing/nx_pylab.py index 709046ea..5609ee51 100644 --- a/networkx/drawing/nx_pylab.py +++ b/networkx/drawing/nx_pylab.py @@ -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 @@ -582,7 +581,7 @@ def draw_networkx_edges(G, pos, # Check if edge_color is an array of floats and map to edge_cmap. # This is the only case handled differently from matplotlib - if cb.iterable(edge_color) and (len(edge_color) == len(edge_pos)) \ + if np.iterable(edge_color) and (len(edge_color) == len(edge_pos)) \ and np.alltrue([isinstance(c,Number) for c in edge_color]): if edge_cmap is not None: assert(isinstance(edge_cmap, Colormap)) @@ -635,7 +634,7 @@ def draw_networkx_edges(G, pos, x2, y2 = dst 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] @@ -643,7 +642,7 @@ def draw_networkx_edges(G, pos, else: shrink_target = to_marker_edge(node_size, node_shape) - if cb.iterable(arrow_colors): + if np.iterable(arrow_colors): if len(arrow_colors) == len(edge_pos): arrow_color = arrow_colors[i] elif len(arrow_colors)==1: @@ -653,7 +652,7 @@ def draw_networkx_edges(G, pos, else: arrow_color = edge_color - if cb.iterable(width): + if np.iterable(width): if len(width) == len(edge_pos): line_width = width[i] else: @@ -768,7 +767,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: |