airbornegeo.nice_scalebar_width#
- nice_scalebar_width(map_width, target_fraction=0.1)[source]#
Round a fraction of the map width to a human-friendly scalebar length.
Returns the value of the form 1, 2, 2.5, 5 or 10 times a power of ten which is closest (in log space) to
map_width * target_fraction, so the bar stays near the requested fraction of the map rather than always rounding up.- Parameters:
- Returns:
A nicely rounded scalebar length, in the units of map_width.
- Return type:
Examples
>>> nice_scalebar_width(1e6) 100000.0 >>> nice_scalebar_width(6e6) 500000.0