Set the positions of all axes of the current figure based on a given layout.

The layout has the following structure:

>>> {"figsize":     [width, height],          # figure size
>>>  "0_map":       [x0, y0, width, height],  # map position
>>>  "1_inset_map": [x0, y0, width, height],  # inset-map position
>>>  "2_logo":      [x0, y0, width, height],  # logo position
>>>  "3_cb":        [x0, y0, width, height],  # colorbar position
>>>  "3_cb_histogram_size": 0.5,  # histogram size of colorbar
>>>  ...
>>>  }
  • The positions are hereby specified in relative figure-units (0-1)
    • If width or height is set to -1, its value will be determined such that the current aspect-ratio of the axes remains the same.

To get the current layout, use:

>>> layout = m.get_layout()

To apply a layout, use:

>>> m.apply_layout(layout)
To save a layout to disc and apply it at a later stage, use
>>> m.get_layout(filepath=<FILEPATH>)
>>> m.apply_layout(<FILEPATH>)


The layout is dependent on the order at which the axes ahve been created! It can only be re-applied to a given figure if the order at which the axes are created remains the same!

Maps aways preserve the aspect ratio. If you provide values for width/height that do not match the aspect-ratio of the map, the values will be adjusted accordingly. By default, smaller values take precedence. To fix one value and adjust the other accordingly, use -1 for width or height! (e.g. {β€œ0_map”: [0.1, 0.1, 0.8, -1]})


layout (dict, str or pathlib.Path) –

If a dict is provided, it is directly used to define the layout.

If a string or a pathlib.Path object is provided, it will be used to read a previously dumped layout (e.g. with m.get_layout(filepath))