class eelbrain.plot.ColorBar(cmap, vmin=None, vmax=None, label=True, label_position=None, label_rotation=None, clipmin=None, clipmax=None, orientation='horizontal', unit=None, contours=(), width=None, ticks=None, threshold=None, ticklocation='auto', background='white', tight=True, h=None, w=None, *args, **kwargs)

A color-bar for a matplotlib color-map

cmap : str | Colormap | array

Name of the color-map, or a matplotlib Colormap, or LUT.

vmin : scalar

Lower end of the scale mapped onto cmap.

vmax : scalar

Upper end of the scale mapped onto cmap.

label : bool | str

Label for the x-axis (default is the unit, or if no unit is provided the name of the colormap).

label_position : ‘left’ | ‘right’ | ‘top’ | ‘bottom’

Position of the axis label. Valid values depend on orientation.

label_rotation : scalar

Angle of the label in degrees (For horizontal colorbars, the default is 0; for vertical colorbars, the default is 0 for labels of 3 characters and shorter, and 90 for longer labels).

clipmin : scalar

Clip the color-bar below this value.

clipmax : scalar

Clip the color-bar above this value.

orientation : ‘horizontal’ | ‘vertical’

Orientation of the bar (default is horizontal).

unit : str

Unit for the axis to determine tick labels (for example, u'µV' to label 0.000001 as ‘1’).

contours : iterator of scalar (optional)

Plot contour lines at these values.

width : scalar

Width of the color-bar in inches.

ticks : {float: str} dict | sequence of float

Customize tick-labels on the colormap; either a dictionary with tick-locations and labels, or a sequence of tick locations. To draw no ticks, set to ().

threshold : scalar

Set the alpha of values below threshold to 0 (as well as for negative values above abs(threshold)).

ticklocation : ‘auto’, ‘top’, ‘bottom’, ‘left’, ‘right’

Where to place ticks and label.

background : matplotlib color

Background color (for colormaps including transparency).

Also accepts General layout parameters.


add_hline(self, y[, axes]) Draw a horizontal line on one or more axes
add_hspan(self, bottom, top[, axes]) Draw a horizontal bar on one or more axes
add_vline(self, x[, axes]) Draw a vertical line on one or more axes
add_vspan(self, xmin, xmax[, axes]) Draw a vertical bar on one or more axes
close(self) Close the figure.
draw(self) (Re-)draw the figure (after making manual changes).
draw_crosshairs(self[, enable]) Draw crosshairs under the cursor
image(self[, name, format]) Create FMTXT Image from the figure
save(self, *args, **kwargs) Short-cut for Matplotlib’s savefig()
set_name(self, name) Set the figure window title
set_xlabel(self, label[, ax]) Set the label for the x-axis
set_xtick_rotation(self, rotation) Rotate every x-axis tick-label by an angle (counterclockwise, in degrees)
set_ylabel(self, label[, ax]) Set the label for the y-axis