networkx.drawing.layout.rescale_layout¶
-
rescale_layout
(pos, scale=1)[source]¶ Returns scaled position array to (-scale, scale) in all axes.
The function acts on NumPy arrays which hold position information. Each position is one row of the array. The dimension of the space equals the number of columns. Each coordinate in one column.
To rescale, the mean (center) is subtracted from each axis separately. Then all values are scaled so that the largest magnitude value from all axes equals
scale
(thus, the aspect ratio is preserved). The resulting NumPy Array is returned (order of rows unchanged).Parameters: - pos (numpy array) – positions to be scaled. Each row is a position.
- scale (number (default: 1)) – The size of the resulting extent in all directions.
Returns: pos – scaled positions. Each row is a position.
Return type: numpy array