This release makes the sf package
optional. ggseg now draws brains from a lightweight polygon
representation by default, so it installs and plots even on systems
where sf (and its GDAL / GEOS / PROJ system libraries) is
unavailable — including WebAssembly and air-gapped setups.
geom_brain(), position_brain(), and
annotate_brain() produce the same figures as before, now
drawn without sf. sf has moved from Imports to
Suggests.geom_sf_label(), layer other sf geoms, or wrangle the
geometry directly, convert an atlas with as_sf_atlas() and
use ggplot2::geom_sf(). See
vignette("geom-sf").geom_brain_sf() and
position_brain_sf() remain for a transition period but are
deprecated and will be removed in a future release.position_brain(zoom = ...) crops each view onto the regions
you’re highlighting so they fill the panel, with the surrounding brain
reduced to a tidy grey frame. Use zoom = TRUE to follow the
regions in your data, or name them explicitly; zoom_pad
sets the margin. Especially handy for focus atlases where only a few
structures carry values.annotate_brain()
now places labels clear of the brain instead of on top of it. The new
padding argument (5% of the plot height by default)
controls the gap.annotate_brain() works with whichever position
you gave the geom — there’s no separate labelling function to
remember.geom_brain(context = FALSE) drops the grey, unlabelled
regions and tightens the layout around the regions you’re plotting.dplyr::group_by() and facet_wrap() /
facet_grid() draw the full atlas in every panel.label
(e.g. "lh_bankssts") now joins to the atlas directly, in
addition to region.fill is mapped, geom_brain() fills
regions with the atlas’s own colours, and the stray “No shared levels”
warning that appeared when filtering by hemisphere or view is gone.coord_brain() keeps brain proportions undistorted;
geom_brain() applies it automatically, so you rarely need
to add it yourself.scale_brain() family keeps working with
the current ggseg.formats.suit cerebellar atlas is re-exported alongside
dk(), aseg(), and tracula().position_brain().This is a major release that simplifies the package architecture by moving atlas data structures and utilities to the ggseg.formats package.
ggseg() is now defunct and errors immediately. Use
ggplot() + geom_brain() instead.
Atlas data (dk, aseg) is no longer
bundled in ggseg. Atlases are now provided by ggseg.formats and
re-exported as functions: dk(), aseg(),
tracula(). Code using the bare objects (e.g.,
atlas = dk) must be updated to
atlas = dk().
The following functions have been removed and are now in
ggseg.formats: as_brain_atlas(),
is_brain_atlas(), brain_atlas(),
brain_regions(), brain_labels(),
brain_pal(), brain_pals_info(),
ggseg_atlas(), as_ggseg_atlas(),
is_ggseg_atlas(), read_freesurfer_stats(),
read_freesurfer_table(),
read_atlas_files().
scale_brain2(), scale_fill_brain2(),
scale_colour_brain2(), and
scale_color_brain2() are deprecated in favour of
scale_brain_manual(),
scale_fill_brain_manual(),
scale_colour_brain_manual(), and
scale_color_brain_manual().
scale_brain(), scale_fill_brain(),
scale_colour_brain(), and scale_color_brain()
are deprecated. Atlas palettes are now applied automatically by
geom_brain().
The side argument in geom_brain() and
position_brain() has been renamed to
view.
New annotate_brain() function adds view labels
(e.g., “left lateral”) to brain plots, respecting the layout from
position_brain().
New scale_brain_manual() family for applying custom
named colour palettes to brain plots.
position_brain() gains nrow,
ncol, and views arguments for grid-based
layout control of subcortical and tract atlases.
adapt_scales() now accepts atlas objects directly
(not just pre-converted coordinate data frames), and handles
"tract" atlas types alongside subcortical.
geom_brain() now automatically applies the atlas
colour palette when no fill aesthetic is mapped.
Messaging uses cli for all user-facing output
(brain_join() warnings and info messages).
Rewrote and reorganised all vignettes with updated examples and renamed files for cleaner URLs.
Added tracula (white matter tract) atlas as a re-export from ggseg.formats.
Improved documentation throughout with updated roxygen2 docs.
hemi and side to geomposition_brain() to accept character vector,
and also support subcortical atlasesNew large update, many new features. Of particular note is the introduction of the brain sf geom, which improved speed, and adaptability of the plots.
ggseg() will stay for a while, but is superseded by a
simple features geomgeom_brain introduced as a new function to plot the
atlas data
position_brain()brain_atlas which contains simple
features dataplot() functions for ggseg_atlas and brain_atlas
classes for a quick look at atlasesbrain_regions functions to easily extract the unique
names of regions for an atlasprint method for atlases classes ggseg_atlas
and brain_atlasarea renamed to region
Changed atlas.info to function atlas_info()
Changed brain.pal to function brain_pal()
Changed atlas.info to function atlas_info()
Reduced code necessary for brain_pals_info
Simplified display_brain_pal()
Moved palettes of ggsegExtra atlases to ggsegExtra package
Added a NEWS.md file to track changes to the
package.
Added compatibility with grouped
data.frames
Reduced internal atlases, to improve CRAN compatibility
Added function to install extra atlases from github easily
Changes vignettes to comply with new functionality