From d1bc136304fdd8b4d88aa823848a65d4aa02d16d Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Thu, 21 Mar 2024 22:32:32 +0100 Subject: [PATCH] Center locs around zero --- networkx/drawing/layout.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/networkx/drawing/layout.py b/networkx/drawing/layout.py index 2006c473cf73..8f25690622b9 100644 --- a/networkx/drawing/layout.py +++ b/networkx/drawing/layout.py @@ -1251,7 +1251,8 @@ def estimate_factor(n, swing, traction, speed, speed_efficiency, jitter_toleranc else: return pos - pos_arr = np.random.rand(len(G), dim) * max_pos_range - min_pos_range + # center locs around 0 + pos_arr = (np.random.rand(len(G), dim) - 0.5) * (max_pos_range - min_pos_range) mass = np.zeros(len(G)) size = np.zeros(len(G))