xoa.plot.add_scalebar#
- xoa.plot.add_scalebar(ax, length=None, units=None, loc=None, pad=None, segments=None, height=None, color=None, effect=None, effect_kw=None, zorder=None, **kwargs)[source]#
Add a scale bar to a map
The default values of the parameters that are
Nonecome from theplot.scalebar_<name>options.The length of the bar is the ground distance along the horizontal direction of the axes at the position of the bar, so it accounts for the distortion of the projection. It is computed when the function is called: call it after the extent is set.
- Parameters:
ax (cartopy.mpl.geoaxes.GeoAxes)
length (None, float) – Length of the bar in
units. It defaults to a round value, seeget_scalebar_length(), that is at most a fifth of the width of the axes.units (None, {"m", "km", "nmi"})
loc (None, {"lower left", "lower right", "upper left", "upper right"}) – Corner of the axes where the bar is placed
pad (None, float) – Distance to the corner in axes coordinates
segments (None, int) – Number of alternating black and white segments
height (None, float) – Height of the bar in axes coordinates
color (None, color) – Color of the dark segments, the labels and the frame
effect (None, bool, str, list(str)) – Add a
"shadow", a"glow"or both, which are drawn below the artists to make them stand out. True is a shorthand for the shadow.effect_kw (None, dict) – Parameters of the effects: the blur
widthin points, thealpha, thecolorand, for the shadow, theoffsetin points. Give a dict per effect to set them separately, like{"glow": {"color": "y"}}.zorder (None, float)
kwargs – Extra parameters are passed to
matplotlib.text.Text, likefontsize.
- Returns:
list – The artists: the segments and the label