#

Note

This documents the development version of NetworkX. Documentation for the current release can be found here.

#

networkx.drawing.layout.rescale_layout_dict

rescale_layout_dict(pos, scale=1)[source]

Return a dictionary of scaled positions keyed by node

Parameters
  • pos (A dictionary of positions keyed by node)

  • scale (number (default: 1)) – The size of the resulting extent in all directions.

Returns

pos

Return type

A dictionary of positions keyed by node

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)}

See also

rescale_layout()