salem.DataLevels

class salem.DataLevels(data=None, levels=None, nlevels=None, vmin=None, vmax=None, extend=None, cmap=None)[source]

Assigns the right color to your data.

Simple tool that ensures the full compatibility of the plot colors and the colorbar. It’s working principle is best understood with a few examples, available in the docs.

__init__(data=None, levels=None, nlevels=None, vmin=None, vmax=None, extend=None, cmap=None)[source]

Instanciate.

Parameters
see the set_* functions

Methods

__init__([data, levels, nlevels, vmin, ...])

Instanciate.

append_colorbar(ax[, position, size, pad])

Appends a colorbar to existing axes

colorbarbase(cax, **kwargs)

Returns a ColorbarBase to add to the cax axis.

get_colorbarbase_kwargs()

If you need to make a colorbar based on a given DataLevel state.

plot(ax)

Add a kind of plot of the data to an axis.

set_cmap([cm])

Set a colormap.

set_data([data])

Any kind of data array (also masked).

set_extend([extend])

Colorbar extensions: 'neither' | 'both' | 'min' | 'max'

set_levels([levels])

Levels you define.

set_nlevels([nlevels])

Automatic N levels.

set_plot_params([levels, nlevels, vmin, ...])

Shortcut to all parameters related to the plot.

set_vmax([val])

Maximum level value.

set_vmin([val])

Mininum level value.

to_rgb()

Transform the data to RGB triples.

update(d)

Update the properties of DataLevels from the dictionary d.

visualize([ax, title, orientation, ...])

Quick plot, useful for debugging.

Attributes

extend

Clever getter.

levels

Clever getter.

nlevels

Clever getter.

norm

Clever getter.

vmax

Clever getter.

vmin

Clever getter.