networkx.drawing.layout.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
>>> pos = {0: (0, 0), 1: (1, 1), 2: (0.5, 0.5)} >>> nx.rescale_layout_dict(pos) {0: (-1.0, -1.0), 1: (1.0, 1.0), 2: (0.0, 0.0)}
>>> pos = {0: (0, 0), 1: (-1, 1), 2: (-0.5, 0.5)} >>> nx.rescale_layout_dict(pos, scale=2) {0: (2.0, -2.0), 1: (-2.0, 2.0), 2: (0.0, 0.0)}