Learn R Programming

fMRItools (version 0.7.2)

plot_FC_gg: Plot FC with ggplot2

Description

Plot a FC matrix.

Usage

plot_FC_gg(
  mat,
  colFUN = NULL,
  title = "FC Matrix",
  legTitle = "",
  group_divs = NULL,
  group_cols = RColorBrewer::brewer.pal(8, "Set2"),
  labs = NULL,
  uppertri_means = TRUE,
  divColor = "black",
  lim = 0.5,
  diagVal = 1,
  labs_margin_y = NULL,
  labs_margin_x = 0
)

Value

The plot

Arguments

mat

The FC matrix

colFUN

A scale_fill function. If NULL, use a red-blue diverging palette if there are negative values in mat, and viridis' inferno sequential palette otherwise.

title

The plot title. Default: "FC Matrix".

legTitle

The legend title. Default: "".

group_divs, group_cols

Split the FC matrix into groups of contiguous rows/columns? Use group_divs to indicate the index of the first element in each group. For example, if the groups are 1-8, 9-15, and 16 to 25, set group_divs=c(1, 9, 16). Groups will be indicated by a color bar along the left and top sides of the plot. Use group_cols to change the colors. By default, group_divs is NULL (no groups).

labs

Labels to place along the y-axis? If is.null(group_divs), this should be a character vector labeling each row of mat, or a dot dot dot. If !is.null(group_divs), this may alternatively be a character vector labeling each group.

uppertri_means

Use the upper triangle of the FC matrix to show the mean of each group indicated by group_divs? Default: TRUE. Has no effect if group_divs is NULL.

divColor

Color of group dividers and outline of the FC matrix. Default: "black".

lim

Length-two numeric vector indicating the limits for the color bar. Values beyond lim will be clipped. If NULL, the limits will be set based on the largest magnitude value in mat (no clipping). If length-one, the left limit will be 0 if there are no negative values, or -lim if there are. Default: .5.

diagVal

On-diagonal values will be set to this value. (uppertri_means are calculated before diagVal is used.)

labs_margin_y, labs_margin_x

Margin value for labels. For the y-axis, a value of NULL (default) will set the margin value adaptively depending on the size of the FC matrix such that the labels are almost flush with the y-axis. The default for the x-axis is 0, which also results in labels almost flush with the x-axis.