rescale_layout_dict¶
- rescale_layout_dict(pos, scale=1)[source]¶
Return a dictionary of scaled positions keyed by node
- Parameters
- posA dictionary of positions keyed by node
- scalenumber (default: 1)
The size of the resulting extent in all directions.
- Returns
- posA dictionary of positions keyed by node
See also
Examples
>>> import numpy as np >>> pos = {0: np.array((0, 0)), 1: np.array((1, 1)), 2: np.array((0.5, 0.5))} >>> nx.rescale_layout_dict(pos) {0: array([-1., -1.]), 1: array([1., 1.]), 2: array([0., 0.])}
>>> pos = {0: np.array((0, 0)), 1: np.array((-1, 1)), 2: np.array((-0.5, 0.5))} >>> nx.rescale_layout_dict(pos, scale=2) {0: array([ 2., -2.]), 1: array([-2., 2.]), 2: array([0., 0.])}