π Scalebarsο
A scalebar can be added to a map via Maps.add_scalebar()
.
By default, the scalebar will dynamically estimate an appropriate scale and position based on the currently visible map extent.
To change the number of segments for the scalebar, use
s = m.add_scalebar(n=5)
ors.set_n(5)
To set the length of the segments to a fixed distance, use
s = m.add_scalebar(scale=1000)
ors.set_scale(1000)
To fix the position of the scalebar, use
s = m.add_scalebar(pos=(20, 40))
ors.set_position(20, 40)
In addition, many style properties of the scalebar can be adjusted to get the look you want.
check the associated setter-functions
ScaleBar.set_< label / scale / lines / labels >_props
below!
Add a scalebar to the map. |
from eomaps import Maps
m = Maps(Maps.CRS.Sinusoidal())
m.add_feature.preset.ocean()
s = m.add_scalebar()
|
![]()
|
The returned ScaleBar
object provides the following useful methods:
Base class for EOmaps scalebars. |
|
Print the command that will reproduce the scalebar in its current state. |
|
Apply a style-preset to the Scalebar. |
|
Remove the scalebar from the map. |
|
Set the length of a segment of the scalebar in meters. |
|
Set number of segments to use for the scalebar. |
|
Set the position of the colorbar. |
|
Set the style properties of the labels. |
|
Set the style properties of the scale. |
|
Set the style properties of the lines connecting the scale and the labels. |
|
Set the style properties of the background patch. |
|
Automatically evaluate an appropriate scale for the scalebar. |
|
Set if the scalebar is interactive (True) or not (False). |
|
Set the size_factor that is used to adjust the size of the labels. |
|
Return the current position (and orientation) of the scalebar. |
|
Get the currently used scale of the scalebar. |
|
Get the current size-factor of the scalebar. |