new_layer

Maps.new_layer(layer=None, copy_data_specs=False, copy_classify_specs=False, copy_shape=True)

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.

  • copy_data_specs (bool) – Indicator if the corresponding properties should be copied to the new layer. By default no settings are copied.

  • copy_shape (bool) – Indicator if the corresponding properties should be copied to the new layer. By default no settings are copied.

  • copy_classify_specs (bool) – Indicator if the corresponding properties should be copied to the new layer. By default no settings are copied.

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

copy

general way for copying Maps objects