deltametrics.plot.VariableInfo

class deltametrics.plot.VariableInfo(name, **kwargs)

Variable styling and information.

This class holds information for a specific underlying data variable (e.g., eta or velocity). Properties are used throughout DeltaMetrics for plotting.

Examples

You can override any of the parameters by passing a value during instantiation of the VariableInfo. For example, to set the colormap for a variable vegetation_density as a range of green shades we would create the VariableInfo as:

>>> import matplotlib
>>> from deltametrics.plot import VariableInfo
>>> veg = VariableInfo("vegetation_density", cmap="Greens")
>>> veg.cmap
<matplotlib.colors.LinearSegmentedColormap object at 0x...>
>>> veg.cmap.N
64

which creates a 64 interval colormap from the matplotlib Greens colormap. If instead we wanted just three colors, we could specify the colormap manually:

>>> veg3 = VariableInfo(
...     "vegetation_density", cmap=matplotlib.colormaps["Greens"].resampled(3)
... )
>>> veg3.cmap.N
3

We can then set a more human-readable label for the variable:

>>> veg3.label = "vegetation density"
__init__(name, **kwargs)

Initialize the VariableInfo.

Parameters:
  • name (str) – Name for variable to access from.

  • cmap (matplotlib.colors.Colormap, str, optional) – Colormap to use to diplay the variable.

  • label (str, optional) – How to display the variable name when plotting (i.e., a human-readable name). If not specified, the value of name is used.

  • norm (matplotlib.colors.Norm, optional) –

    ???

  • vmin (float, optional) – Limit the colormap or axes to this lower-bound value.

  • vmax (float, optional) – Limit the colormap or axes to this upper-bound value.

Methods

__init__(name, **kwargs)

Initialize the VariableInfo.

Attributes

cmap

Colormap to use to diplay the variable.

label

How to display the variable name when plotting.

name

Name for variable to access from.

norm

vmax

Limit the colormap or axes to this upper-bound value.

vmin

Limit the colormap or axes to this lower-bound value.

property cmap

Colormap to use to diplay the variable.

property label

How to display the variable name when plotting.

property name

Name for variable to access from.

property norm

???

property vmax

Limit the colormap or axes to this upper-bound value.

property vmin

Limit the colormap or axes to this lower-bound value.