Skip to content

Commit

Permalink
Shrink the source side of an arrow properly when drawing a directed e…
Browse files Browse the repository at this point in the history
…dge. networkx#3805 (networkx#3806)

* shrink source as shrink target

* shrink the source side of an arrow properly
  • Loading branch information
sanghack81 authored Jan 31, 2020
1 parent 4f1d26f commit b662434
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions networkx/drawing/nx_pylab.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,12 +638,13 @@ def to_marker_edge(marker_size, marker):
shrink_source = 0 # space from source to tail
shrink_target = 0 # space from head to target
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]
shrink_target = to_marker_edge(marker_size, node_shape)
source, target = edgelist[i][:2]
source_node_size = node_size[nodelist.index(source)]
target_node_size = node_size[nodelist.index(target)]
shrink_source = to_marker_edge(source_node_size, node_shape)
shrink_target = to_marker_edge(target_node_size, node_shape)
else:
shrink_target = to_marker_edge(node_size, node_shape)
shrink_source = shrink_target = to_marker_edge(node_size, node_shape)

if shrink_source < min_source_margin:
shrink_source = min_source_margin
Expand Down

0 comments on commit b662434

Please sign in to comment.