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
posnumpy array

positions to be scaled. Each row is a position.

scalenumber (default: 1)

The size of the resulting extent in all directions.

Returns
posnumpy array

scaled positions. Each row is a position.