Skip to contents

[Deprecated]

The sf rendering path is deprecated. geom_brain_sf() renders an atlas via ggplot2::geom_sf() and coord_sf(). For new code, use geom_brain() (the polygon default), or convert the atlas with as_sf_atlas() and use ggplot2::geom_sf() directly for the full sf toolkit (labels, other sf layers).

Usage

geom_brain_sf(
  mapping = aes(),
  data = NULL,
  atlas,
  hemi = NULL,
  view = NULL,
  position = NULL,
  show.legend = NA,
  inherit.aes = TRUE,
  ...
)

Arguments

mapping

Set of aesthetic mappings created by ggplot2::aes().

data

A data.frame containing variables to map. If NULL, the atlas is plotted without user data. Add a facet with ggplot2::facet_wrap() to draw one brain per group.

atlas

A ggseg_atlas object (e.g. dk(), aseg(), tracula()).

hemi

Character vector of hemispheres to include (e.g. "left", "right"). Defaults to all hemispheres in the atlas.

view

Character vector of views to include, as recorded in the atlas data. For cortical atlases: "lateral", "medial". For subcortical/tract atlases: slice identifiers like "axial_3". Defaults to all views.

position

Brain-view layout: the result of a call to position_brain(), a layout string (e.g. "horizontal", "vertical"), or a layout formula (e.g. hemi ~ view). Strings and formulas are passed to position_brain(). Use "identity" to keep the atlas polygons' raw coordinates. Per-view zoom is set through position_brain()'s zoom.

show.legend

Logical. Should this layer be included in the legends?

inherit.aes

Logical. If FALSE, overrides the default aesthetics rather than combining with them.

...

Additional arguments passed to ggplot2::geom_polygon().

Value

A list of ggplot2 layer and coord objects.

GeomBrainSf ggproto

GeomBrainSf is the ggplot2::Geom backing the deprecated geom_brain_sf() sf path. It renders atlas geometry via sf::st_as_grob() and requires coord_sf(). Up to ggseg 2.2.1 this object was the exported GeomBrain; GeomBrain is now the polygon geom that backs the default geom_brain(), so extension code doing ggplot2::layer(geom = GeomBrain) against the sf path must switch to GeomBrainSf.

Examples

if (FALSE) { # \dontrun{
# Deprecated: prefer geom_brain(). Shown for reference only.
library(ggplot2)
ggplot() +
  geom_brain_sf(atlas = dk())
} # }