visbrain.objects.ColorbarObj

class visbrain.objects.ColorbarObj(name, rect=(-0.7, -2, 1.5, 4), transform=None, parent=None, verbose=None, **kwargs)[source][source]

Create a colorbar object.

Parameters:
namestr

Name of the colorbar object. Alternatively, you can pass an other object (like BrainObj or SourceObj) to get their colorbar.

recttuple | (-.7, -2, 1.5, 4)

Camera rectangle. The rect input must be a tuple of four floats describing where the camera (start_x, start_y, length_x, length_y).

cmapstring | None

Matplotlib colormap (like ‘viridis’, ‘inferno’…).

climtuple/list | None

Colorbar limit. Every values under / over clim will clip.

isvminbool | False

Activate/deactivate vmin.

vminfloat | None

Every values under vmin will have the color defined using the under parameter.

vmaxfloat | None

Every values over vmin will have the color defined using the over parameter.

undertuple/string | None

Matplotlib color under vmin.

overtuple/string | None

Matplotlib color over vmax.

cblabelstring | ‘’

Colorbar label.

cbtxtszfloat | 5..

Text size of the colorbar label.

cbtxtshfloat | 2.3

Shift for the colorbar label.

txtcolorstring | ‘white’

Text color.

txtszfloat | 3.

Text size for clim/vmin/vmax text.

txtshfloat | 1.2

Shift for clim/vmin/vmax text.

borderbool | True

Display colorbar borders.

bwfloat | 2.

Border width.

limtxtbool | True

Display vmin/vmax text.

bgcolortuple/string | (0., 0., 0.)

Background color of the colorbar canvas.

ndigitsint | 2

Number of digits for the text.

widthfloat | 0.17

Colorbar width.

transformVisPy.visuals.transforms | None

VisPy transformation to set to the parent node.

parentVisPy.parent | None

Markers object parent.

verbosestring

Verbosity level.

Notes

List of supported shortcuts :

  • s : save the figure

  • <delete> : reset camera

Examples

>>> from visbrain.objects import ColorbarObj
>>> cb = ColorbarObj('cbar', cmap='viridis', clim=(4., 78.2), vmin=10.,
>>>                  vmax=72., cblabel='Colorbar title', under='gray',
>>>                  over='red', txtcolor='black', cbtxtsz=40, cbtxtsh=2.,
>>>                  txtsz=20., width=.04)
>>> cb.preview()

Methods

__init__(name[, rect, transform, parent, ...])

Init.

animate([step, interval, iterations])

Animate the object.

copy()

Get a copy of the object.

describe_tree()

Tree description.

preview([bgcolor, axis, xyz, show, obj, ...])

Previsualize the result.

record_animation(name[, n_pic, bgcolor])

Record an animated object and save as a *.gif file.

render()

Render the canvas.

screenshot(saveas[, print_size, dpi, unit, ...])

Take a screeshot of the scene.

set_shortcuts_to_canvas(canvas)

Set shortcuts to a VisbrainCanvas.

to_dict()

Return a dictionary of all colorbar args.

to_kwargs([addisminmax])

Return a dictionary for input arguments.

update()

Fonction to run when an update is needed.

update_from_dict(kwargs)

Update attributes from a dictionary.

Examples using visbrain.objects.ColorbarObj

Brain object (BrainObj) : complete tutorial

Brain object (BrainObj) : complete tutorial

Image, time-frequency map and spectrogram objects

Image, time-frequency map and spectrogram objects

Region Of Interest object (RoiObj) : complete tutorial

Region Of Interest object (RoiObj) : complete tutorial

Source object (SourceObj) : complete tutorial

Source object (SourceObj) : complete tutorial

Topoplot object (TopoObj) : complete tutorial

Topoplot object (TopoObj) : complete tutorial