add_compass

Maps.add_compass(pos=None, pos_transform='axes', scale=10, style='compass', patch=None, txt='N', pickable=True, layer=None, ignore_invalid_angles=False)

Add a “compass” or “north-arrow” to the map.

Note

You can use the mouse to pick the compass and move it anywhere on the map. (the directions are dynamically updated if you pan/zoom or pick the compass)

  • If you press the “delete” key while clicking on the compass, it is removed. (same as calling compass.remove())

  • If you press the “d” key while clicking on the compass, it will be disconnected from pick-events (same as calling compass.set_pickable(False))

Parameters:
  • pos (tuple or None, optional) – The initial position of the compass with respect to the transformation defined as “pos_transform”. Note that you can also move the compass with the mouse!

  • pos_transform (string, optional) –

    Indicator in what coordinate-system the initial position is provided.

    • ”axes”: relative axis-coordinates in the range (0-1)

    • ”lonlat”: coordinates provided as (longitude, latitude)

    • ”plot_crs”: coordinates provided in the crs used for plotting.

    The default is “axes”.

  • scale (float, optional) – A scale-factor for the size of the compass in relation to the size of the whole figure. The default is 10.

  • style (str, optional) –

    • “north arrow” : draw only a north-arrow

    • ”compass”: draw a compass with arrows in all 4 directions

    The default is “compass”.

  • patch (False, str or tuple, optional) – The color of the background-patch (can be any color specification supported by matplotlib). See Compass.set_patch(…) for more styling options. The default is “w”.

  • txt (str, optional) – Indicator which directions should be indicated. - “NESW” : add letters for all 4 directions - “NE” : add only letters for North and East (same for other combinations) - None : don’t add any letters The default is “N”.

  • pickable (bool, optional) – Indicator if the compass should be static (False) or if it can be dragged with the mouse (True). The default is True

  • layer (str, optional) – The layer to put the compass on. The default is “all”.

  • ignore_invalid_angles (bool, optional) –

    • If True the compass will always (silently) use the last valid rotation-angle in case the correct angle could not be determined.

    • If False, a warning will be issued in case the angle could not be determined, and a red border will be drawn around the compass to indicate that it might not point in the right direction.

    The default is False

Returns:

compass – A compass-object that can be used to manually adjust the style and position of the compass or remove it from the map.

Return type:

eomaps.Compass