plots.styles.legends

Attributes

DEFAULT_LEGEND_LABEL

Functions

colorbar(layer, *args[, shrink, aspect, ax, color])

Produce a colorbar for a given layer.

disjoint(layer, *args[, location, frameon])

Produce a disjoint legend for a given layer.

estimate_legend_cols(axes, labels[, position])

Estimates the number of columns for a legend based on the total width or height of a list of axes,

vector(layer, *args[, vector_reference])

Module Contents

plots.styles.legends.DEFAULT_LEGEND_LABEL = '{variable_name} ({units})'
plots.styles.legends.colorbar(layer, *args, shrink=0.8, aspect=35, ax=None, color='black', **kwargs)

Produce a colorbar for a given layer.

Parameters:
  • layer (earthkit.maps.charts.layers.Layer) – The layer for which to produce a colorbar.

  • **kwargs – Any keyword arguments accepted by matplotlib.figures.Figure.colorbar.

plots.styles.legends.disjoint(layer, *args, location='bottom', frameon=False, **kwargs)

Produce a disjoint legend for a given layer.

Parameters:
  • layer (earthkit.maps.charts.layers.Layer) – The layer for which to produce a colorbar.

  • **kwargs – Any keyword arguments accepted by matplotlib.figures.Figure.legend.

plots.styles.legends.estimate_legend_cols(axes, labels, position='top')

Estimates the number of columns for a legend based on the total width or height of a list of axes, the position of the legend, and the lengths of the labels.

Args: axes (list of matplotlib.axes.Axes): The list of axes objects to which the legend will be aligned. labels (list of str): The labels for the legend. position (str): Position of the legend, choices are ‘top’, ‘bottom’, ‘left’, ‘right’.

Returns: int: Estimated number of columns for the legend.

plots.styles.legends.vector(layer, *args, vector_reference=16, **kwargs)