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

A color-bar for a matplotlib color-map

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

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

  • vmax (Optional[float]) – Upper end of the scale mapped onto cmap.

  • label (Union[bool, str]) – Label for the x-axis (default is the unit, or if no unit is provided the name of the colormap).

  • label_position (Optional[Literal[‘left’, ‘right’, ‘top’, ‘bottom’]]) – Position of the axis label. Valid values depend on orientation.

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

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

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

  • unit (Optional[str]) – Unit for the axis to determine tick labels (for example, u'µV' to label 0.000001 as ‘1’).

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

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

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

    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 (Optional[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 (Optional[Axes]) – Plot the colorbar to the right of, and matching in height of the axes specified in right_of.

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

  • below (Optional[Axes]) – Plot the colorbar below, and matching in width of these 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