gam_growthrate_plot_combine: combine age plot and tile slop heatmap into one figure...

View source: R/growthrate_gam.R

gam_growthrate_plot_combineR Documentation

combine age plot and tile slop heatmap into one figure (w/grob and grid)

Description

save two figures (only use if you need to mess with titles)

Usage

gam_growthrate_plot_combine(ageplot_luna, tile_luna, PDFout = NA)

Arguments

ageplot_luna

ggplot plot of subject coef by age (top part of figure)

tile_luna

tile heatmap of slope (bottom part of figure)

PDFout

PDF name to save output into, NA no saved, NULL not plotted

Examples

 data <- data.frame(age=1:100,fd_mean=1:100,subj=as.factor(letters[1:25]), conn_ahpc_vmpfc=randu[1:100,1])
 mod<-mgcv::gam(conn_ahpc_vmpfc~s(age)+s(fd_mean)+s(subj, bs="re"), data=data)
 ci<-LNCDR::gam_growthrate(mod, 'age', n = 10000, qnt = c(0.025, 0.975), idvar='subj')
 plist <- gam_growthrate_plot(data, mod, ci, 'age', idvar='subj')
 plist$tile <- plist$tile + xlab('AGE')
 g <- gam_growthrate_plot_combine(plist$ageplot, plist$tile, 'gammod.pdf')

LabNeuroCogDevel/LNCDR documentation built on July 13, 2024, 10:02 a.m.