🧭 Compass (or North Arrow)

A compass can be added to the map via Maps.add_compass():

  • To add a North-Arrow, use m.add_compass(style="north arrow")

Interacting with the compass

The compass is a pickable object!

Click on it with the LEFT mouse button to drag it around!

While a compass is picked (and the LEFT mouse button is pressed), the following additional interactions are available:

  • press delete on the keyboard: remove the compass from the plot

  • rotate the mouse wheel: scale the size of the compass

Maps.add_compass

Add a "compass" or "north-arrow" to the map.

from eomaps import Maps
m = Maps(Maps.CRS.Stereographic())
m.add_feature.preset.ocean()

m.add_compass()
_images/compass.gif

The compass object is dynamically updated if you pan/zoom the map, and it can be dragged around on the map with the mouse.

The returned compass object has the following useful methods assigned:

Compass.remove

Remove the compass from the map.

Compass.set_patch

Set the style of the background patch.

Compass.set_scale

Set the size scale-factor of the compass.

Compass.set_pickable

Set if the compass can be picked with the mouse or not.

Compass.set_ignore_invalid_angles

Set how to deal with invalid rotation-angles.

Compass.get_position

Return the current position of the compass.

Compass.get_scale

Return the current size scale-factor of the compass.