new_layer

Maps.new_layer(layer=None, inherit_data=False, inherit_classification=False, inherit_shape=True, **kwargs)

Create a new Maps-object that shares the same plot-axes.

Parameters:
  • layer (int, str or None) –

    The name of the layer at which map-features are plotted.

    • If β€œall”: the corresponding feature will be added to ALL layers

    • If None, the layer of the parent object is used.

    The default is None.

  • inherit_data (bool) –

    Indicator if the corresponding properties should be inherited from the parent Maps-object.

    By default only the shape is inherited.

    For more details, see Maps.inherit_data() and Maps.inherit_classification()

  • inherit_classification (bool) –

    Indicator if the corresponding properties should be inherited from the parent Maps-object.

    By default only the shape is inherited.

    For more details, see Maps.inherit_data() and Maps.inherit_classification()

  • inherit_shape (bool) –

    Indicator if the corresponding properties should be inherited from the parent Maps-object.

    By default only the shape is inherited.

    For more details, see Maps.inherit_data() and Maps.inherit_classification()

Returns:

A connected copy of the Maps-object that shares the same plot-axes.

Return type:

eomaps.Maps

Examples

Create a new Maps-object on an existing layer

>>> from eomaps import Maps
>>> m = Maps(layer="base")    # m.layer == "base"
>>> m2 = m.new_layer()        # m2.layer == "base"

Create a new Maps-object representing a new layer

>>> from eomaps import Maps
>>> m = Maps(layer="base")           # m.layer == "base"
>>> m2 = m.new_layer("a new layer")  # m2.layer == "a new layer"

Create a new layer and immediately delete it after it has been exported. (useful to free memory if a lot of layers are be exported)

>>> from eomaps import Maps
>>> m = Maps(layer="base")
>>> with m.new_layer("a new layer") as m2:
>>>     ...
>>>     m2.show()                           # make the layer visible
>>>     m2.savefig(...)                     # save it as an image

See also

Maps.copy

general way for copying Maps objects