eelbrain.plot.ColorBar

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=None, tight=True, h=None, w=None, axes=None, right_of=None, left_of=None, below=None, offset=0, **kwargs)

A color-bar for a matplotlib color-map

Parameters:
  • cmap (Any) – Name of the color-map, or a matplotlib Colormap, or LUT.

  • vmin (float) – Lower end of the scale mapped onto cmap.

  • vmax (float) – 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 (Literal['left', 'right', 'top', 'bottom']) – Position of the axis label. Valid values depend on orientation.

  • label_rotation (float) – 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 (float) – Clip the color-bar below this value.

  • clipmax (float) – Clip the color-bar above this value.

  • orientation (Literal['horizontal', 'vertical']) – Orientation of the bar (default is horizontal).

  • unit (str | float) – Unit for the axis to determine tick labels (for example, 'µV' to label 0.000001 as ‘1’) or multiplier (e.g., 1e-6).

  • contours (Sequence[float]) – Plot contour lines at these values.

  • width (float) – Width of the color-bar in inches.

  • ticks (int | Dict[float, str] | Sequence[float]) –

    Control tick-labels on the colormap. Can be:

    • An integer number of evenly spaced ticks to draw

    • A sequence of tick locations (() to draw no ticks at all)

    • A {float: str} dictionary with tick-locations and labels

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

  • ticklocation (Literal['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.

  • right_of (Axes) – Plot the colorbar to the right of, and matching in height of the axes specified in right_of.

  • left_of (Axes) – Plot the colorbar to the keft of, and matching in height of these axes.

  • below (Axes) – Plot the colorbar below, and matching in width of these axes.

  • offset (float) – Additional offset when using right_of/left_of/below.

  • tight (bool) –

  • h (float) –

  • w (float) –

  • axes (Axes) –

Methods

add_hline(y[, axes])

Draw a horizontal line on one or more axes

add_hspan(bottom, top[, axes])

Draw a horizontal bar on one or more axes

add_vline(x[, axes])

Draw a vertical line on one or more axes

add_vspan(xmin, xmax[, axes])

Draw a vertical bar on one or more axes

close()

Close the figure.

draw()

(Re-)draw the figure (after making manual changes).

draw_crosshairs([enable])

Draw crosshairs under the cursor

draw_outline([color])

Draw the outline of the figure

image([name, format, close])

Create FMTXT Image from the figure

save(*args, **kwargs)

Short-cut for Matplotlib's savefig()

set_name(name)

Set the figure window title

set_xlabel(label[, ax])

Set the label for the x-axis

set_xtick_rotation(rotation)

Rotate every x-axis tick-label by an angle (counterclockwise, in degrees)

set_ylabel(label[, ax])

Set the label for the y-axis