@@ -484,7 +484,7 @@ def draw_networkx_edges(G, pos,
484
484
try :
485
485
import matplotlib
486
486
import matplotlib .pylab as pylab
487
- import numpy as nmex
487
+ import numpy as np
488
488
from matplotlib .colors import colorConverter ,Colormap
489
489
from matplotlib .collections import LineCollection
490
490
except ImportError :
@@ -502,7 +502,7 @@ def draw_networkx_edges(G, pos,
502
502
return None
503
503
504
504
# set edge positions
505
- edge_pos = nmex .asarray ([(pos [e [0 ]],pos [e [1 ]]) for e in edgelist ])
505
+ edge_pos = np .asarray ([(pos [e [0 ]],pos [e [1 ]]) for e in edgelist ])
506
506
507
507
if not cb .iterable (width ):
508
508
lw = (width ,)
@@ -512,16 +512,16 @@ def draw_networkx_edges(G, pos,
512
512
if not cb .is_string_like (edge_color ) \
513
513
and cb .iterable (edge_color ) \
514
514
and len (edge_color )== len (edge_pos ):
515
- if nmex .alltrue ([cb .is_string_like (c )
515
+ if np .alltrue ([cb .is_string_like (c )
516
516
for c in edge_color ]):
517
517
# (should check ALL elements)
518
518
# list of color letters such as ['k','r','k',...]
519
519
edge_colors = tuple ([colorConverter .to_rgba (c ,alpha )
520
520
for c in edge_color ])
521
- elif nmex .alltrue ([not cb .is_string_like (c )
521
+ elif np .alltrue ([not cb .is_string_like (c )
522
522
for c in edge_color ]):
523
523
# If color specs are given as (rgb) or (rgba) tuples, we're OK
524
- if nmex .alltrue ([cb .iterable (c ) and len (c ) in (3 ,4 )
524
+ if np .alltrue ([cb .iterable (c ) and len (c ) in (3 ,4 )
525
525
for c in edge_color ]):
526
526
edge_colors = tuple (edge_color )
527
527
alpha = None
@@ -555,7 +555,7 @@ def draw_networkx_edges(G, pos,
555
555
# just not work with an older mpl
556
556
if edge_colors is None :
557
557
if edge_cmap is not None : assert (isinstance (edge_cmap , Colormap ))
558
- edge_collection .set_array (nmex .asarray (edge_color ))
558
+ edge_collection .set_array (np .asarray (edge_color ))
559
559
edge_collection .set_cmap (edge_cmap )
560
560
if edge_vmin is not None or edge_vmax is not None :
561
561
edge_collection .set_clim (edge_vmin , edge_vmax )
@@ -578,7 +578,7 @@ def draw_networkx_edges(G, pos,
578
578
x2 ,y2 = dst
579
579
dx = x2 - x1 # x offset
580
580
dy = y2 - y1 # y offset
581
- d = nmex .sqrt (float (dx ** 2 + dy ** 2 )) # length of edge
581
+ d = np .sqrt (float (dx ** 2 + dy ** 2 )) # length of edge
582
582
if d == 0 : # source and target at same position
583
583
continue
584
584
if dx == 0 : # vertical edge
@@ -588,9 +588,9 @@ def draw_networkx_edges(G, pos,
588
588
ya = y2
589
589
xa = dx * p + x1
590
590
else :
591
- theta = nmex .arctan2 (dy ,dx )
592
- xa = p * d * nmex .cos (theta )+ x1
593
- ya = p * d * nmex .sin (theta )+ y1
591
+ theta = np .arctan2 (dy ,dx )
592
+ xa = p * d * np .cos (theta )+ x1
593
+ ya = p * d * np .sin (theta )+ y1
594
594
595
595
a_pos .append (((xa ,ya ),(x2 ,y2 )))
596
596
@@ -602,10 +602,10 @@ def draw_networkx_edges(G, pos,
602
602
)
603
603
604
604
# update view
605
- minx = nmex .amin (nmex .ravel (edge_pos [:,:,0 ]))
606
- maxx = nmex .amax (nmex .ravel (edge_pos [:,:,0 ]))
607
- miny = nmex .amin (nmex .ravel (edge_pos [:,:,1 ]))
608
- maxy = nmex .amax (nmex .ravel (edge_pos [:,:,1 ]))
605
+ minx = np .amin (np .ravel (edge_pos [:,:,0 ]))
606
+ maxx = np .amax (np .ravel (edge_pos [:,:,0 ]))
607
+ miny = np .amin (np .ravel (edge_pos [:,:,1 ]))
608
+ maxy = np .amax (np .ravel (edge_pos [:,:,1 ]))
609
609
610
610
w = maxx - minx
611
611
h = maxy - miny
0 commit comments