summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Barnowski <rossbar@berkeley.edu>2022-05-11 16:42:30 -0700
committerGitHub <noreply@github.com>2022-05-11 19:42:30 -0400
commit1760d25f6c056fbed39843db7523d597670fe35d (patch)
treeeac15c9e31203229acb6d0a31e322edfbbc341e2
parent8bea55e3071ed71eab4fb6650a45f0cdf5c911d4 (diff)
downloadnetworkx-1760d25f6c056fbed39843db7523d597670fe35d.tar.gz
Replace np.flip with indexing in layouts. (#5623)
-rw-r--r--networkx/drawing/layout.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/networkx/drawing/layout.py b/networkx/drawing/layout.py
index d20751e2..c3d37d78 100644
--- a/networkx/drawing/layout.py
+++ b/networkx/drawing/layout.py
@@ -337,7 +337,7 @@ def bipartite_layout(
pos = np.concatenate([top_pos, bottom_pos])
pos = rescale_layout(pos, scale=scale) + center
if align == "horizontal":
- pos = np.flip(pos, 1)
+ pos = pos[:, ::-1] # swap x and y coords
pos = dict(zip(nodes, pos))
return pos
@@ -1100,7 +1100,7 @@ def multipartite_layout(G, subset_key="subset", align="vertical", scale=1, cente
nodes.extend(layer)
pos = rescale_layout(pos, scale=scale) + center
if align == "horizontal":
- pos = np.flip(pos, 1)
+ pos = pos[:, ::-1] # swap x and y coords
pos = dict(zip(nodes, pos))
return pos