Maps.cb.keypress.make_artists_temporary#

keypress.make_artists_temporary(layer=None)#

A contextmanager to make all artists created within the context temporary (e.g. they are removed on the next relevant event)

Parameters:

layer (str, optional) – The layer at which the artists will be added. If None, the layer of the calling Maps-object is used The default is None.

Examples

>>> m = Maps()
>>> m.add_title("Click on the map to remove temporary features")
>>> m.add_feature.preset.coastline()
>>> with m.cb.click.make_artists_temporary():
>>>     m.ax.plot([-60,-20,10,20,30,40], "g.-", label="A temporary line")
>>>     m.ax.text(45, 50, "A temporary Text", c="r")
>>>     m.ax.legend(title="A temporary legend")

See also

add_temporary_artist

Make one (or more) artists temporary.