Skip to contents

Plot tract profiles for each bundle as a facet and each metric as a figure.

Usage

plot_tract_profiles(
  df,
  metrics = NULL,
  bundles = NULL,
  bundles_col = "tractID",
  group_col = NULL,
  line_func = "mean",
  linewidth = 1,
  ribbon_func = "mean_cl_boot",
  ribbon_alpha = 0.25,
  n_groups = 3,
  pal_name = "colorblind",
  out_dir = getwd(),
  figsize = c(8, 11.5)
)

Arguments

df

Data frame.

metrics

Name(s) of the metrics to plot per figure, character vector. By default, will be all diffusion metrics in the provided data frame.

bundles

Name(s) of the tract bundles to plot per facet, character vector. By default, will be all tract bundles in the provided data frame.

bundles_col

Name of the column in the provided data frame with the tract bundles.

group_col

Name of the column in the data frame to group by as a color, character. By default, no grouping variable is provided.

line_func

Line function that provides the line positioning. See stat_summary for more information.

linewidth

Line thickness of the tract profile line.

ribbon_func

Ribbon function that provides the range for the ribbon. See stat_summary for more information.

ribbon_alpha

Ribbon alpha level.

n_groups

Number of groups to split a numeric grouping variable.

pal_name

Grouping color palette name, character. Default is colorblind.

out_dir

Output directory of saved plots.

figsize

Figure size. A numeric vector of (width, height) in inches.

Value

List of plot handles corresponding to the specified metrics.

Examples

if (FALSE) { # \dontrun{
df <- read_afq_sarica()

plot_tract_profiles(
  df,
  metrics = c("fa"),
  bundles = c("Left Corticospinal", "Right Corticospinal"),
  group_col = "class",
  figsize   = c(8, 6)
)

plot_tract_profiles(
  df,
  metrics = c("fa"),
  bundles = c("Left Corticospinal", "Right Corticospinal"),
  group_col = "age",
  n_groups  = 3,
  pal_name  = "Spectral",
  figsize   = c(8, 6)
)
} # }