get_layoutο
- Maps.get_layout(filepath=None, override=False, precision=5)ο
Get the positions of all axes within the current plot.
The returned 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 >>> ... >>> }
To re-apply a layout, use:
>>> l = m.get_layout() >>> m.set_layout(l)
Note
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]})
- Parameters:
filepath (str or pathlib.Path, optional) β
If provided, a json-file will be created at the specified destination that can be used in conjunction with m.set_layout(β¦) to apply the layout:
>>> m.get_layout(filepath=<FILEPATH>, override=True) >>> m.apply_layout_layout(<FILEPATH>)
You can also manually read-in the layout-dict via: >>> import json >>> layout = json.load(<FILEPATH>)
override (bool) β Indicator if the file specified as βfilepathβ should be overwritten if it already exists. The default is False.
precision (int or None) β The precision of the returned floating-point numbers. If None, all available digits are returned The default is 5
- Returns:
layout β A dict of the positions of all axes, e.g.: {1:(x0, y0, width height), β¦}
- Return type:
dict or None