Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the user guide for the big picture.

8.11.31.19. nilearn.plotting.displays.GlassBrainAxes

class nilearn.plotting.displays.GlassBrainAxes(ax, direction, coord, plot_abs=True, **kwargs)[source]

An MPL axis-like object that displays a 2D projection of 3D volumes with a schematic view of the brain.

Parameters
axAxes

The matplotlib axes in which the plots will be drawn.

direction{‘x’, ‘y’, ‘z’}

The directions of the view.

coordfloat

The coordinate along the direction of the cut.

plot_absbool, optional

If set to True the absolute value of the data will be considered. Default=True.

__init__(ax, direction, coord, plot_abs=True, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

transform_to_2d(data, affine)[source]

Returns the maximum of the absolute value of the 3D volume along an axis.

Parameters
data3D numpy.ndarray

The 3D volume.

affine4x4 numpy.ndarray

The affine of the volume.

draw_position(size, bg_color, **kwargs)[source]

Not implemented as it does not make sense to draw crosses for the position of the cuts since we are taking the max along one axis.

add_object_bounds(bounds)[source]

Ensures that axes get rescaled when adding object bounds.

draw_2d(data_2d, data_bounds, bounding_box, type='imshow', **kwargs)[source]

Draw 2D.

draw_left_right(size, bg_color, **kwargs)[source]

Draw the annotation “L” for left, and “R” for right.

Parameters
sizefloat, optional

Size of the text areas.

bg_colormatplotlib color: str or (r, g, b) value

The background color for both text areas.

draw_scale_bar(bg_color, size=5.0, units='cm', fontproperties=None, frameon=False, loc=4, pad=0.1, borderpad=0.5, sep=5, size_vertical=0, label_top=False, color='black', fontsize=None, **kwargs)[source]

Adds a scale bar annotation to the display.

Parameters
bg_colormatplotlib color: str or (r, g, b) value

The background color of the scale bar annotation.

sizefloat, optional

Horizontal length of the scale bar, given in units. Default=5.0.

unitsstr, optional

Physical units of the scale bar (‘cm’ or ‘mm’). Default=’cm’.

fontpropertiesFontProperties or dict, optional

Font properties for the label text.

frameonbool, optional

Whether the scale bar is plotted with a border. Default=False.

locint, optional

Location of this scale bar. Valid location codes are documented here. Default=4.

padint or float, optional

Padding around the label and scale bar, in fraction of the font size. Default=0.1.

borderpadint or float, optional

Border padding, in fraction of the font size. Default=0.5.

sepint or float, optional

Separation between the label and the scale bar, in points. Default=5.

size_verticalint or float, optional

Vertical length of the size bar, given in units. Default=0.

label_topbool, optional

If True, the label will be over the scale bar. Default=False.

colorstr, optional

Color for the scale bar and label. Default=’black’.

fontsizeint, optional

Label font size (overwrites the size passed in through the fontproperties argument).

**kwargs :

Keyworded arguments to pass to AnchoredOffsetbox.

get_object_bounds()[source]

Return the bounds of the objects on this axes.