Skip to contents

ggseg3d creates and returns an interactive Three.js brain mesh visualization. Dispatches to atlas-type-specific methods via prepare_brain_meshes().

Usage

ggseg3d(
  .data = NULL,
  atlas = dk(),
  label_by = "region",
  text_by = NULL,
  colour_by = "colour",
  palette = NULL,
  na_colour = "darkgrey",
  na_alpha = 1,
  ...,
  label = deprecated(),
  text = deprecated(),
  colour = deprecated()
)

Arguments

.data

A data.frame to use for plot aesthetics. Must include a column called "region" corresponding to regions.

atlas

A ggseg_atlas object containing 3D vertex mappings, or a string naming an atlas function (deprecated).

label_by

String. Column name used as hover label for each region.

text_by

String. Column name for extra hover text shown below the region label.

colour_by

String. Column name mapped to mesh colours.

palette

Character vector of colour names or hex colours. May instead be a named numeric vector whose names are the colours and whose values are the breakpoints those colours sit at.

na_colour

String. Colour drawn for regions with no value in .data, as a colour name or a hex code.

na_alpha

Numeric between 0 and 1. Opacity of regions with no value in .data: 1 (default) draws them opaque in na_colour, lower values fade them. Cortical and cerebellar surfaces fade per vertex, subcortical structures and tracts per mesh.

...

Type-specific arguments passed to the atlas method. See section Type-specific arguments below.

label, text, colour

[Deprecated] Use label_by, text_by, and colour_by instead.

Value

an htmlwidget object for interactive 3D brain visualization

Type-specific arguments

Cortical atlases (cortical_atlas):

surface

"LCBC" (default, an alias for "inflated") or any surface resolve_brain_mesh() accepts.

hemisphere

Character vector of hemispheres: "left", "right", or their "lh"/"rh" spellings.

edge_by

Column name for region boundary edges.

brain_meshes

Custom brain mesh data.

Cerebellar atlases (cerebellar_atlas):

surface_opacity

Opacity of the cerebellar surface mesh. Defaults to 0.3 when the atlas carries deep nuclei, so they stay visible through the surface, and 1 otherwise.

Tract atlases (tract_atlas):

tract_color

"palette" (default) or "orientation" (direction-based RGB).

tube_radius

Tube radius (numeric, default 2).

tube_segments

Tube segment count (integer, default 10).

See also

pan_camera() for camera position, set_background() for background colour, set_legend() for legend visibility

Other brain plots: ggsegray()

Author

Athanasia Mowinckel and Didac Piñeiro

Examples

ggseg3d()
ggseg3d(hemisphere = "left") |> pan_camera("left lateral")
ggseg3d() |> set_legend(FALSE)
ggseg3d() |> set_background("black")