t1 <- system.file("extdata", "mni_template_2009c_2mm.nii.gz", package = "ggbrain")
# version where render is added to the object in a ggplot-style chain
gg_obj <- ggbrain() +
images(c(underlay = t1)) +
slices(c("x = 25%", "x = 75%")) +
geom_brain("underlay") +
render() + # convert to ggplot-friendly object
ggplot2::theme(text=ggplot2::element_text(family="Serif"))
# version where a ggbrain object is created in one step, then rendered in another
brain_obj <- ggbrain() +
images(c(underlay = t1)) +
slices(c("x = 25%", "x = 75%")) +
geom_brain("underlay")
gg_obj <- render(brain_obj) + patchwork::plot_annotation(title="Overall title")
Run the code above in your browser using DataLab