peek_layer

click_callbacks.peek_layer(layer='1', how=(0.4, 0.4), alpha=1, **kwargs)

Swipe between data- or WebMap layers or peek a layers through a rectangle.

Parameters
  • layer (str or list) –

    • if str: The name of the layer you want to peek at.

    • if list: A list of layer-names to peek at. (alternatively you can also separate individual layer-names with a β€œ|” character, e.g.: β€œlayer1|layer2”)

  • how (str , float or tuple, optional) –

    The method you want to visualize the second layer. (e.g. swipe from a side or display a rectangle)

    • ”left” (β†’), β€œright” (←), β€œtop” (↓), β€œbottom” (↑): swipe the layer at the mouse-position.

    • ”full”: overlay the layer on the whole figure

    • if float: peek a square at the mouse-position, specified as percentage of the axis-width (0-1)

    • if tuple: (width, height) peek a rectangle at the mouse-position, specified as percentage of the axis-size (0-1)

    The default is β€œleft”.

  • alpha (float, optional) – The transparency of the peeked layer. (must be between 0 and 1) The default is 1.

  • **kwargs – additional kwargs passed to a rectangle-marker. the default is (fc=”none”, ec=”k”, lw=1)

Note

You must draw something on the layer first!

To assign a layer to an object, either use the layer=… argument when adding objects (e.g. m.plot_map(layer=1)), or use a new Maps-layer via

>>> m = Maps()
>>> m2 = m.new_layer(layer="the layer name")
>>> # now all artists added with m2 will be added to the layer
>>> # "the layer name" (if not explicitly specified otherwise)
>>> m2.plot_map()
>>> m.peek_layer(layer="the layer name")