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, **kwargs)

A color-bar for a matplotlib color-map

Parameters
  • 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.

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

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